this post was submitted on 26 Sep 2023
118 points (88.3% liked)

JavaScript

1982 readers
2 users here now

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] dingleberry@discuss.tchncs.de 14 points 1 year ago* (last edited 1 year ago) (1 children)

This would've been much easier to read with plain numbers. Also, easier to read for color blind people.

[1, 2, 3, 4].push(5)             => [1, 2, 3, 4, 5]
[1, 2, 3, 4].unshift(5)          => [5, 1, 2, 3, 4]
[1, 2, 3, 4].pop()               => [1, 2, 3]
[1, 2, 3, 4].shift()             => [2, 3, 4]
[1, 2, 3, 4].map(x => x = 5)     => [5, 5, 5, 5]
[1, 2, 1, 4].filter(x => x == 1) => [1, 1]
[1, 2, 3, 4].reverse()           => [4, 3, 2, 1]
[1, 2, 3, 4].at(2)               => 3
[1, 2, 3, 4].slice(2)            => [3, 4]
[โ€“] tst123@lemmy.world 2 points 1 year ago

Feel free to upload it here when you finish making it