javascript - Google Chrome Console Copying Variables -
i came across interesting behavior in google chrome's console when "copying" variable.
try following on "fresh" chrome console one line @ time:
var = "string";
var copy = a;
copy.length; //returns uncaught typeerror: cannot read property 'length' of undefined
it turns out "copy" function baked in chrome: https://developer.chrome.com/devtools/docs/commandline-api#copyobject
copy happens unlucky choice variable name in console but, curiously, if reassign twice work (try following on new "fresh" console):
var = "string";
var copy = a;
var copy = a; //declare twice
copy.length; //6
is there reason why works way in console? on 64-bit 43.0.2357.130
Comments
Post a Comment