Daily tasks with JavaScript arrays
Victor Hazbun

Victor Hazbun @victorhazbun

About: Founder at @BonsaiLabs

Location:
Colombia
Joined:
Jun 22, 2019

Daily tasks with JavaScript arrays

Publish Date: Jul 3 '19
92 12

Arrays are everywhere and we have to use them all the time.

I created this article specially for you, so you have a quick reference of the most common things you usually do with Arrays on a daily basis 😊

Table Of Contents 📋

Find in array 🔍

Filter an array 🕵️

Loop arrays 🔁

Sort an array of objects ⬆️ ⬇️

Add an element to an array 🗳️

Remove an element from an array 🗑️

Create an array from an existing array (Map) 📦

Accumulate array values (Reduce) 🐝

Combine arrays (Concat) 🍔

Hope you enjoyed this reading 🥳. Feel free to save this article into your bookmarks 🔖 so you have it available at your fingertips.

Comments 12 total

  • Dennis Keirsgieter
    Dennis KeirsgieterJul 3, 2019

    In Sort array of objects usersSortedByScoreDesc still returns asc i believe?

    But great reference all together!

    • Victor Hazbun
      Victor HazbunJul 3, 2019

      Fixed! Thanks again!

      • Dennis Keirsgieter
        Dennis KeirsgieterJul 3, 2019

        Did you also include the fix? The result is still the same for me even after a hard refresh!

        • Victor Hazbun
          Victor HazbunJul 3, 2019

          Please refresh again.

          • Victor Hazbun
            Victor HazbunJul 3, 2019

            Worked for you now?

            • Dennis Keirsgieter
              Dennis KeirsgieterJul 3, 2019

              Yes it works now! Altough the json.stringify was actually nice to make it more readable :)

              • Victor Hazbun
                Victor HazbunJul 3, 2019

                I used it for debugging purposes, but now you give me a good idea 😁 - I will put it back everywhere later.

  • Victor Hazbun
    Victor HazbunJul 3, 2019

    You bet, I will continue adding more of this for you.

  • Victor Hazbun
    Victor HazbunJul 3, 2019

    There is another interesting blog I published yesterday 👉 dev.to/victorhazbun/modern-javascr...

  • Zafer
    ZaferJul 3, 2019

    Broken chrome tab after too many embed code editor :) It would be better if it had been placed less opts.

    • Victor Hazbun
      Victor HazbunJul 3, 2019

      I will try to split my blog posts, i.e. Part 1, Part 2, etc. Since the embed code editor gives the reader the ability to play with the code. 😅

Add comment