简体   繁体   中英

Chrome Web Inspector shows too many global variables

I'm beginner+ in javascript and developing, so this might be a question of good practices.

When I build js files, I have a bunch of global vars on top, that I can access anywhere which is fine.

But when I use the Chrome Web Inspector with breakpoints, I can easily see the values of Local vars, but the Global vars are "hidden" within all the transparent « navigator functions/variables ».

See picture : http://i.stack.imgur.com/lKtVu.png

So my question is in 2 steps.

  1. Is it possible to hide all the semi-transparent « navigator functions/variables » from this window pane ?

  2. Would it make a better file if all my js+vars was « embedded » like function AllMyFile(){ var blah blah blah function… } AllMyFile()

Advice welcome here :)

It would be helpful if you provided some code examples. Based on the image I'm not sure if I understand what you mean by hidden variables. However, its basically understood that all data in javascript is available to the client / users. If you have some reason users from accessing data then consider writing parts of your code in PHP and retrieve it through AJAX.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM