What is undefined x 1 in JavaScript?

Part of the ECMAScript standard, JavaScript consoles will display objects as arrays when the objects are array-like, such as ["hello", "world"] for an object containing strings that are numerically indexed. The implementation of JavaScript arrays varies from browser to browser, but they generally default to a sparse implementation—likely the same one used for property access of regular objects. However, Google Chrome appears to choose the undefined x n notation to display sparse arrays. Here is how it looks, Type this code into Chrome developer console :

arr = new Array(4); arr[2] = "abcd"; console.log(arr);
[undefined × 2, "abcd", undefined × 1]

Above output show, the notation "*2" to represent two consecutive "undefined" values, indicating their occurrence in succession. However, in cases where a single undefined value exists, the "x 1" notation could be omitted. This demonstrates that the Chrome browser employs a distinct approach to displaying uninitialized indexes within arrays.

JavaScript Sparse Arrays

A sparse array is characterized by non-contiguous indexes that may not begin at 0. Typically, the length property of an array indicates the count of elements it holds. In the case of a sparse array, the length property exceeds the actual element count due to gaps in index sequence. As the array becomes more extensively sparse—featuring numerous missing indexes—it loses its optimized efficiency in index-based access. In terms of performance, a sufficiently sparse array essentially resembles a hashtable, with associated access characteristics.


"undefined x 1" is not a recognized or standard operation in JavaScript. It appears to be a mistaken or erroneous expression that combines the keyword "undefined" with the "x" symbol, which is not a valid operator in JavaScript. This combination does not have a defined meaning or behavior in the language.