Created
October 3, 2013 22:42
-
-
Save markhibberd/6818249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> var name = function() {} | |
> typeof name | |
"string" | |
> var namex = function() {} | |
> typeof namex | |
"function" |
JavaScript commandment #3: Globals are literally the devil
s/javascript/* programming language
Looks like executing any javascript in global scope is bad. As soon as you're in function scope, it's fine:
> var name=function(){}; console.log(typeof name);
string
> (function() { var name=function(){}; console.log(typeof name); })();
function
Looks like executing any javascript in global scope is bad.
Actually, I think this generalises to:
Javascript is bad.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yup. As far as i know (and mdn just backed me up) name is not a standard so its going to come down to what the write status for that property is when chrome creates it. So you can't even rely on that behaviour :D