What is Undefined in JavaScript?



This is not a feature of JavaScript but is Chrome's way of displaying uninitialized indexes in arrays (and array-like objects). For example, if you console.log the following −

Example

console.log(Array(100))

Output

[undefined × 100]

This is better than printing [undefined, undefined, undefined,...] as it is more readable.

Ayush Gupta
Ayush Gupta

Updated on: 2019-09-16T08:03:51+05:30

164 Views

Kickstart Your Career

Get certified by completing the course

Get Started