简体   繁体   中英

Modifying local javascript variables in the console

If a page has code that wraps all variables in a scope, like this:

$(function() {
    var attempts = 3;
});

Is it possible to edit the variables inside that scope from the browser console (eg Developer Tools for Chrome or Firebug for Firefox)?

Yes, just set a breakpoint. Upon reaching the breakpoint you can modify all variables that are in scope at the breakpoint - including those hidden within closures.

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