this post was submitted on 30 Mar 2024
7 points (61.3% liked)

Programming

18348 readers
277 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
7
Useful JavaScript Array Methods (javascript.withcodeexample.com)
submitted 10 months ago by harendra21 to c/programming
top 7 comments
sorted by: hot top controversial new old
[–] [email protected] 4 points 10 months ago (1 children)

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!

[–] [email protected] 3 points 10 months ago

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.

[–] towerful 2 points 10 months ago (1 children)

Could at least show usage of indexes

[–] harendra21 1 points 10 months ago

Thank you for your feedback, I will update it.

[–] [email protected] 1 points 10 months ago (1 children)

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 1 points 10 months ago
[–] [email protected] 1 points 10 months ago

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