Last Updated: February 25, 2016
·
1.565K
· mlb

Bookmarklet : get my JavaScript custom globals

Too many global variables is bad. And slower than local ones.

Want to know when you forgot a var statement or when you need to decrease the number of custom globals in your page ? Put the following link in your Bookmarks bar and open the console when you click on it.

javascript:console.log((function(a,b,c,d,e,f,g,h,i){for(e%20in%20window)a.push(e);f=document.createElement("iframe"),f.style.display="none",document.body.appendChild(f),g=f.contentWindow;for(h%20in%20g)b.push(h);for(i=a.length;i>d;d++)~b.indexOf(a[d])||c.push(a[d]);return%20c})([],[],[],0))

Enjoy

2 Responses
Add your response

Awesome, thanks!

over 1 year ago ·

awesome... really helpful for javascript developers

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside