EDIT: THE SOURCE OF MY UNCERTAINTY
I have discovered why I was puzzled. It turns out that the Stack Overflow code snippet tool produces an ambiguous output when using console.log in this case which lead me to think something was undefined when in fact it was non-existent.
For the simple command console.log([undefined,,4]), the consoles in Chrome, Firefox, Safari and Opera produce correct and unambiguous output:
Chrome:

Firefox:

Safari:

Opera:

However, the output from the code snippet tool on Stack Overflow (in any browser) is ambiguous and at least misleading if not technically incorrect (depending on how you define what console.log should do). (While I eventually posted this question on Software Engineering, which does not have the code snippet tool, I originally worked through the problem on Stack Overflow, which does, leading to me seeing the confusing output shown below.) I have to split the input and output into two separate images just because they are on different parts of the screen...
Stack Overflow code snippet tool input:

Stack Overflow code snippet tool output:

Note that in this output the first and second elements are shown identically, i.e. as undefined, in contrast with all the browser console outputs above which show the first element as undefined but the element in the second position as non-existent.
Just for people's interest, note the following bug in Internet Explorer 11 when I try to show the same thing in its console:
