javascript performance tuning

https://www.steveworkman.com/html5-2/javascript/2011/improving-javascript-xml-node-finding-performance-by-2000/

Advertisements

ways to check if a variable is undefined in javascript

var x;

1. x === undefined  (returns true)

2. typeof x == ‘undefined’ (returns true)

3. !x (returns true)

4. x == void 0 (returns true, not a good idea though because it is hard to understand)

4. if you have a variable x, when its value is undefined but typeof x returns ‘string’ and x === undefined returns false, then try x == ‘undefined’. 🙂