DEV Community

Cover image for Dev Tools Tricks: Store objects and elements as variables in the console

Dev Tools Tricks: Store objects and elements as variables in the console

Phil Nash on January 12, 2017

Browser dev tools are so full of features it's hard to keep up. I bet every developer knows a different set of features to each other. I wanted to ...
Collapse
 
spalonytoster profile image
Maciej Posłuszny • Edited

In fact, if you select a different element in the inspector then it will become the subject of $0 and you will NOT lose the reference to the old one. It will become $1! It goes on to $4 so at any time you have references to 5 most recent elements! Great post, cheers :)

Collapse
 
philnash profile image
Phil Nash

Nice extra tip, thanks!

Collapse
 
rysilva profile image
Ryan Silva

I write angular.element($0).scope().$ctrl so much there should be a chrome shortcut for that!

Collapse
 
philnash profile image
Phil Nash

I bet you could write a quick Chrome extension for that!