Open Rishabh1208 opened 4 years ago
I agree that https://github.com/ganqqwerty/123-Essential-JavaScript-Interview-Questions#2-what-would-be-the-output-of-following-code-2 is incorrect.
(function() {
var array1 = [];
var array2 = new Array(100);
var array3 = new Array(['1',2,'3',4,5.6]);
console.log(array1);
console.log(array2);
console.log(array3);
console.log(array3.length);
}());
But to clarify what @Rishabh1208 is saying...
For me, in Windows Chrome, the result is:
[]
[empty × 100]
[["1", 2, "3", 4, 5.6]]
1
Thanks for a really helpful long list of thought-provoking questions, though. :-)
Thanks @ryancwalsh
In the Array topic, the answer to question2 is wrong. It should be 2 i.e ([] [undefined × 100] Array[5] 1)