Copy From the Console


I'm working on a problem right now where I get large amounts of data back from a function.

That data might not be correct.

I need to inspect it, so I log it to the console. Unforuntaly, I have to go through the nested array by hand. It's not very fun.

Large nested array in the console.

Wouldn't it be awesome if I could save that whole logged array and search it in a text editor?

How to:

  1. Open your browser console.
  2. Right click on the logged object. Click "Store as Global Variable". Box showing the options for right click This saves the object to a temporary variable, which is returned in the console. Screenshot of temporary storage variable
  3. In my case, the temporary variable is named temp1. To copy it to the system-wide "clipboard", enter copy(temp1) in the console. Screenshot of copying storage variable
  4. Open your favorite text editor and paste (Cmd-V). 5000 lines of code in sublime text editor

So Much Data!

As you can see in the screenshot above, there's a ton of data...almost 5000 lines! There's no way I could verify all of it myself. Now I have the data in a file and can write a quick script to do the checking for me.

comments powered by Disqus