tst123@lemmy.world to JavaScript@programming.dev · 1 year agoArray methodslemmy.worldimagemessage-square9fedilinkarrow-up1137arrow-down119
arrow-up1118arrow-down1imageArray methodslemmy.worldtst123@lemmy.world to JavaScript@programming.dev · 1 year agomessage-square9fedilink
minus-squaredingleberry@discuss.tchncs.delinkfedilinkarrow-up16arrow-down2·edit-21 year agoThis 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]
minus-squaretst123@lemmy.worldOPlinkfedilinkarrow-up3arrow-down2·1 year agoFeel free to upload it here when you finish making it
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]
Feel free to upload it here when you finish making it