DEV Community

Discussion on: `at` coming soon to ECMAScript

nicholaschiasson profile image
Nicholas Omer Chiasson

Does this work with positive out of bounds also, kind of like a modulo of the length? Say arr.length is 4 and you tried, does it give you arr[1]? Just curious.

islamcn profile image
Isla McNeill • Edited

It will give you undefined. That way you're not running yourself in circles.

yoursunny profile image
Junxiao Shi

Modulo is risky because you get NaN on an empty array.

laurieontech profile image
Laurie Author

No. Positive out of bounds is undefined.