Useful JavaScript Array Methods

https://javascript.withcodeexample.com/blog/essential-javascript-array-methods/

6 points · 7 comments · view on lemmy.world

7 Comments

gramie@lemmy.ca · 4 pts · 2y (1 reply)

It's not really necessary to include indexOf() twice in the "Additional Methods" section.

I don't see much points in your page, when something like MDN is available, but I also feel stupid because I didn't know that the forEach() method existed, and it appears that it is ancient!

otl@apubtest2.srcbeat.com · 3 pts · 2y

I don't see much points in your page, when something like MDN is available,

Yeah this is a thing that started to irritate me when I was working on JS projects. So many articles written all describing stuff - not always correct - that is answered by reading standard documentation.

I just kept MDN, Node, React docs open all the time. But working with existing code I kept needing to deal with copy & pasted stuff from blog spam.

simbico@lemmy.zip · 1 pts · 2y

Some other useful stuff: toSorted, toReversed, splice, destructuring, spreading. Last two are not methods but very useful when working with arrays

towerful@programming.dev · 1 pts · 2y (1 reply)

Could at least show usage of indexes

harendra21@programming.dev · 1 pts · 2y

Thank you for your feedback, I will update it.

Nommer@sh.itjust.works · 1 pts · 2y (1 reply)

Good article however I would like it if the scroll bar on the examples was always visible. On mobile it took me a minute to realize there was more to some of the code snippets, like the square function in the .map() example.

harendra21@programming.dev · 1 pts · 2y

Updated it