I often need to copy a variable in Chrome dev tools console to my clipboard. Fortunately, Chrome has this feature built-in using the copy() function.
- Save the variable or right-click an object in Chrome’s console and select Store as Global Variable from the context menu. It will return something like temp1 as the variable name.
- Use the copy() method, so copy(temp1) in the console should copy that object to your clipboard.