See the next snippet of code:
var arr = ; arr.length = 10; // The next statement shows  in the console. console.log(arr); // The next statement shows [undefined × 10] in the console. arr; // The next statement shows undefined in the console. console.log(JSON.stringify(arr));
When JSON.stringify is called it call toJSON method of object but undefined is not an object itself then it calls the object that is in the backend of undefined, returning 'null' as value, this is the reason of undefined == null is true.
When the toString of arr is called it returns an empty string for each undefined value in the array.