Is there a “null coalescing” operator in JavaScript?

Update JavaScript now supports the nullish coalescing operator (??). It returns its right-hand-side operand when its left-hand-side operand is null or undefined, and otherwise returns its left-hand-side operand. Old Answer Please check compatibility before using it. The JavaScript equivalent of the C# null coalescing operator (??) is using a logical OR (||): var whatIWant = … Read more