Javascript in Ten MinutesSpencer TippingDecember 22, 2010Contents1Introduction32Types33Functions43.1Variadic behavior (a cool thing) . . . . . . . . . . . . . . . . . . .43.2Lazy scoping (a cool thing) . . . . . . . . . . . . . . . . . . . . . .43.3The meaning of this (the egregious disaster) . . . . . . . . . . .53.3.1Important consequence: eta-reduction . . . . . . . . . . .64Gotchas74.1Semicolon inference . . . . . . . . . . . . . . . . . . . . . . . . . .74.2Void functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . .74.3var. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84.4Lazy scoping and mutability . . . . . . . . . . . . . . . . . . . . .84.5Equality. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94.6Boxed vs. unboxed. . . . . . . . . . . . . . . . . . . . . . . . . .94.7Things that will silently fail or misbehave. . . . . . . . . . . . .104.8Things that will loudly fail . . . . . . . . . . . . . . . . . . . . . .114.9Throwing things . . . . . . . . . . . . . . . . . . . . . . . . . . . .114.10 Be careful with typeof . . . . . . . . . . . . . . . . . . . . . . . .114.11 Also be careful with instanceof. . . . . . . . . . . . . . . . . .124.12 Browser incompatibilities. . . . . . . . . . . . . . . . . . . . . .135Prototypes135.1Why new is awful . . . . . . . . . . . . . . . . . . . . . . . . . . .145.2Why you should use prototypes . . . . . . . . . . . . . . . . . . .155.3Autoboxing. . . . . . . . . . . . . . . . . . . . . . . . . . . ....