DEV Community

Peter Ellis
Peter Ellis

Posted on

I was today() years old when I found out...

The other day I was debugging a page in Chrome: I was staring at a really complex object that had just been logged to the console, looking for a field with a specific name. If only they'd stringified it before logging, I could then copy it into an editor.

So I just lazily right-clicked the object and...

Store as global variable

How had I missed this before?

...and we've got the object as `temp1`!

I could now call JSON.stringify(temp1) and the field is mine!

Of course I checked in Firefox two minutes later and found out they'd implemented not just this feature but "Copy object" too, which would reveal the JSON in a single step.

But I'll still treasure "Store as global variable" because it also allows you to manipulate said object or call functions.

Ignorance is like a very loud jackhammer, it feels great to take a step away from it.

Top comments (1)

Collapse
 
deciduously profile image
Ben Lovy

Ignorance is like a very loud jackhammer

I'm going to remember this one.