In javascript, chrome console:
var test = [0, 1, 2, 3, 4]
> undefined
var lastIdx = --test.length
> undefined
lastIdx
> 4
test
> [0, 1, 2, 3]
var lastIdx = --(test.length)
> undefined
lastIdx
> 3
test
> [0, 1, 2]
As you already saw, I just want to get the last index of the array through the --array.length, but unfortunately the last element of the array get removed unexpectedly, really cannot understand how come this can/should happen, can someone explain?
--does not mean just "one less than this number". It also decreases whatever you apply it to.