Daniel Escobedo



Lexical Scope and Closures

The scope model that JavaScript employs is called Lexical Scope. So what is it exactly? A scope acts like a container in which your variables and functions are declared. var name = 'Daniel'; function printName() { console.log(name); }; printName(); // Daniel There are two scopes in this...

JavaScript Promises

A simple metaphor I've heard used before is that a Promise in JavaScript is like ordering a cheeseburger at a fast food restaurant. When you pay for the cheeseburger, they give you a receipt with an order number on it. That receipt represents a placeholder...

Testing for NaN in ES6

Reliably testing for NaN has become much simpler (and safer) in ES6 using Number.isNaN( x ): a = "foo" * 2; b = "bar"; Number.isNaN( a ); // true Number.isNaN( b ); // false How is this different than the current isNaN( x )? We are trying to test for, and...