Month: December 2017

Angular 1 vs Angular 2+ Comparing

Since the release of Angular 2 Final I've been slowly going through my Angular 1 tutorials and converting them to Angular 2, both to help me learn the new Ng2 framework as well as share the code with other developers. I find the best way to learn new technologies by building practical real world examples … Continue reading Angular 1 vs Angular 2+ Comparing

Advertisements

JavaScript implicit coercion of empty arrays

JavaScript implicit coercion of empty arrays example: [] == ![] //toBoolean [1] [] == !true [] == false //loose equality round one [2] //toPrimitive([]) [3] "" == false //loose equality round two //toBoolean("") [4] false === false true explanations: 1) First there is operator precedence so ! evaluates before == Negating something calls the internal toBoolean method onto that "something" first. … Continue reading JavaScript implicit coercion of empty arrays