I remember reading years ago that passing negative numbers as the 2nd argument to some of the functions with this syntax (slice
, substr
, etc) was only supported in some browsers, but I can't find the reference.
Just wondering if anyone knows if ary.slice(0, -1)
specifically is safe across all browsers.
Using a negative number for either the start or end value (or both) is safe and will select from the end of the array. It is supported across IE, FF, Chrome, Safari, and Opera.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With