When declaring a variable in javascript, is the default value null?

javascript

Solution

No, it has the default value of `undefined` But if want to use the `!j` condition, it will work with both the values (i.e. undefined or null)

Note that `(j==null)` is `true`, but `(j===null)` is `false`... JavaScript have "falsy" values and sometimes unexpected rules to convert values, plus fancy `===` operator to compare value and type at the same time.

Problem

If I have a declaration as follows: ``` var j; ``` does `j==null` until I set it equal to something?

Original source