How to Copy Variable from Chrome Dev Tools Console

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.

  1. 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.
  2. Use the copy() method, so copy(temp1) in the console should copy that object to your clipboard.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.