- Brendan Eich at Netscape originally wanted to make a dialect of Scheme, but his manager said that people wouldn’t accept “all those parentheses”, and he should make something with a friendlier syntax. Too bad, I would love to able to program Scheme in the browser
- Brendan did sneak in lambda though, he just didn’t call it that 🙂
- No separate character type, just strings of length 1
- == and != do type coercion; === and !== do not
- bitwise operators convert to a 32 bit signed integer and then back to a 64 bit float, so don’t use them for efficiency like you might in C
- don’t use the with statement
- be careful with for (var name in object) due to iteration of inherited members also
- blocks don’t have scope, only functions do
- vars are implicitly global if not declared
4 ways to call a function
- new functionObject(args)
- functionObject.apply(thisObject[, args])
- don’t use eval except for trusted JSON
- http://www.JSLint.com a tool Crockford wrote
- Semicolon insertion: when the compiler sees an error, it attempts to replace a nearby linefeed with a semicolon and try again! Always use the full correct form including semicolon. This was a surprise to me because once I discovered semicolons were optional, I stopped using them for a cleaner look. Oops.
I’ll post another entry after I go through Crockford’s advanced series.