4 ms·
because when you misscalculate the index, then it will not crash, but use the wrong one I'm getting this right?
by tester34 6y ago
because when you misscalculate the index, then it will not crash, but use the wrong one
I'm getting this right?
- robertlagrant 6y agoI don't understand why that would be more error prone than using list[list.length-1]. It's just list[-1].
- tester34 6y agoimagine if you used list[index] where index would be calculated if you misscalculated something and went on negative, then you'd have big exception/error, but when negative indices are viable, then the code will work fine