Skip to content

Instantly share code, notes, and snippets.

@steve54b
Created June 2, 2015 21:26
Show Gist options
  • Save steve54b/488e5072ba73ecd880d3 to your computer and use it in GitHub Desktop.
Save steve54b/488e5072ba73ecd880d3 to your computer and use it in GitHub Desktop.
The value between the two adjacent commas is shown as "undefined" in the response to entry of arr = [1,2,,4] (see section "1st "write some code"). However, as the answer to the 2nd part of this task (see below the dotted line) demonstrates, it appears that undefined equates to a null.
1st "write some code":
> arr = [1,2, ,4]
==> [1,2,undefined × 1,4]
> arr[1]
==> 2
>arr[2]
==> undefined
---------------------------
[1,2,undefined,4].toString() === [1,2,,4].toString()
==> true
or
[1,2,null,4].toString() === [1,2,,4].toString()
==> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment