View JavaScript Class Patterns.md

Throughout this article, I will use Java's Object-Oriented Programming terminologies such as static, private and public.

Pattern 1: Self-construction

This pattern exploits scoping to allow for private and public fields and methods. It is named as Self-construction because the class function (or constructor) has to assign instance methods one by one.

View JavaScript Closure Pitfalls.md

This describes the common mistake with using closures in JavaScript.

A function defines a new environment

Consider:

function makeCounter()
{
  var obj = {counter: 0};
View JavaScript Implicit Boolean Conversion.md

Implicit Boolean Conversion in JavaScript

Only the following values are considered false:

  • null
  • undefined
  • '' (empty string)
  • 0
  • NaN
  • false