Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Sunday, April 8, 2012
Reserved Keywords in Javascript
What Javascript keywords (function names, variables, etc) are reserved?
I discovered today that the word "keywords" is a reserved word in IE javascript. It turns out to be an object that contains a list of all the keywords. No errors are generated if you try and use this as a variable, but any time you try and access the value of your variable you get an object back instead of what you assigned to it. Arg!
http://javascript.about.com/library/blreserved.htm lists them quite nicely.
ReplyDeleteThis is one of the many things discussed in "JavaScript: The Good Parts" by Douglas Crockford.
ReplyDeleteBy the way, I'm not affiliated with the publisher; The book is just that awesome.
I discovered today that the word "keywords" is a reserved word in IE javascript. It turns out to be an object that contains a list of all the keywords. No errors are generated if you try and use this as a variable, but any time you try and access the value of your variable you get an object back instead of what you assigned to it. Arg!
ReplyDeleteheader and footer just broke my script in IE8.
ReplyDelete