Javascript Gotchas

Function Constructor

Function constructor can be invoked without using ()


instanceof Does not Work On Primitive Values


The typeof Operator Is Limited and Buggy


Boolean Object Wrappers Are Always true


Boolean can be called as a function to cast a value to a Boolean


Calling Primitive Wrapper Constructors Without new Returns Primitive Values


Object() Can Produce Primitive Object Wrappers


Accessing Properties On Primitive Values Fails


delete Won't Delete Inherited Properties


Array.length Can Be Set, And Has Side Effects


Credits

Rouben Meschian

rmeschian@gmail.com