|
|
|
|
|
by irjustin
1998 days ago
|
|
Wow, this truly is an "array with a hash/dict at the end" arr = []
arr[-1] = 'neg-one-key'
arr[0] = 'zero-pos'
arr[1] = 'one-pos'
arr[2] = 'two-pos'
arr[-2] = 'neg-two-key'
arr[3] = 'three-pos'
arr // => ["zero-pos", "one-pos", "two-pos", "three-pos", -1: "neg-one-key", -2: "neg-two-key"]
arr.splice(2, 1)
arr // => ["zero-pos", "one-pos", "three-pos", -1: "neg-one-key", -2: "neg-two-key"]
arr[3] // => undefined
Incredibly weird for me. |
|