javascript eval method

后端 未结 4 1510
孤街浪徒
孤街浪徒 2021-01-14 21:47

How can I watch variable values inside of javascript eval() method? And is it possible to \"step into\" and \"step over\" in eval method? For example, with a code like this:

4条回答
  •  伪装坚强ぢ
    2021-01-14 22:38

    Although not thoroughly documented or advised, you can watch local variables.

    var reference;
    
    function alerta(){
      alert(reference[0]);
    }
    
    // Desired to be watched must be called as function arguments
    (function(a){
      reference = arguments;
    
      a = 'taco';
      alerta();
      a = 'updatedValue';
      alerta();
    
    })()
    

    http://jsbin.com/oragan

提交回复
热议问题