Tell us what’s happening:
The answer to the question in quiz:
2. What will be the output of the following code?
let arr = new Array(3);
console.log(arr);
is [<3 empty items>]
Shouldn’t it be: [undefined, undefined, undefined]
like stated in the example above:
const emptyArray = new Array(5);
console.log(emptyArray.length); // 5
console.log(emptyArray); // [undefined, undefined, undefined, undefined, undefined]
Correct me if I’m wrong please.
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:144.0) Gecko/20100101 Firefox/144.0
Challenge Information:
Working with Arrays, Variables, and Naming Practices - How Do You Get the Length for an Array, and How Can You Create an Empty Array of Fixed Length?