DEV Community

Discussion on: `at` coming soon to ECMAScript

Collapse
 
royalfig profile image
Ryan Feigenbaum

Would I use it?
const response = ['No way', 'I don't know', 'Awww yeah'].at(-1)

Collapse
 
hasnaindev profile image
Muhammad Hasnain • Edited

Everybody gangsta until .at(-1) returns undefined.

Collapse
 
jankapunkt profile image
Jan Küster

Would [].at(-1) be like dividing by zero?

 
raulcg profile image
RaulC-G

[].at(-1) == [][[].length - 1] == [][-1] == undefined