Javascript Upgrade

I asked a question before, and someone gave me a guide and I read it and I saw it

var temp = setTimeout, setTimeout = function() {}; 

He said that temp would be undefined due to the rise of JavaScript, and I do not understand why This should not be so?

  var temp; temp = setTimeout; setTimeout = function() {}; 

so why its undefined?

+4
source share
1 answer

This is not the same. Your multiple var declarations also declare setTimeout :

 var temp = setTimeout, setTimeout = function() {}; 

which climbs

 var temp; // = undefined var setTimeout; // = undefined temp = setTimeout; setTimeout = function() {}; 
+5
source

Source: https://habr.com/ru/post/1447641/


All Articles