1. Code
  2. JavaScript

Learn JavaScript Arrays

Scroll to top
Read Time: 5 min

If you already understand the basics of JavaScript arrays, it's time to take your skills to the next level with more advanced topics. In this series of tutorials, you'll explore intermediate-level topics for programming with arrays in JavaScript.

What are JavaScript Arrays?

Arrays are the most commonly used structures for storing data. An array is a single object which can contain multiple values. While a variable is a container for a single value, an array is a container for multiple values.

Arrays in JavaScript are very versatile. They are used to handle collections of data, iterate over elements, manipulate data, and perform operations efficiently.

JavaScript Arrays From Scratch

Envato Tuts+ has some wonderful free courses to help you brush up on the basics of JavaScript arrays or learn them from scratch. 

FREE
1 Hour

JavaScript Array Mastery: Tips, Tricks & Best Practices

Take your JavaScript skills to the next level in this course! You'll master JavaScript arrays and learn some very useful tips and tricks

    FREE
    7.5 Hours

    Learn Modern JavaScript Fundamentals in 7 Hours! FREE COURSE

    In this course, you'll learn all of the essential concepts of the JavaScript language. That's right: all of them!

    • Working With Arrays
    • Iterating and Transforming Arrays
    • Searching and Flattening Arrays
    • Working With the `Array` Constructor
    FREE
    1.6 Hours

    Learn Functional Programming With JavaScript | FREE COURSE

    By the end of this course, you will understand concepts like first-class functions, immutability, composing functions, currying, and even how to work with the DOM in a functional way. 

    • Working With Arrays
    • Understanding map()
    • Filtering Arrays
    • Reducing Arrays

    To take you beyond the basics, these tutorials will provide you will give you an in-depth knowledge of working with JavaScript arrays: 

    1. Adding and Removing Elements From Arrays in JavaScript

    In this article, we'll take a look at various ways to add and remove elements from an array in JavaScript.

    2. Sorting Values With JavaScript

    Sorting arrays is one of the most common tasks you'll do when programming in JavaScript. Therefore, as a JavaScript programmer, it’s essential that you learn how to correctly sort an array because you’ll be doing it a lot in real-life projects. And the wrong sorting technique can really slow your app down!

    3. Searching Arrays in JavaScript

    In this tutorial, you will learn how to search for and find data within JavaScript arrays by using the indexOf(), lastIndexOf(), find(), findLast(), includes(), some(), and every() methods.

    4. Converting and Transforming Arrays in JavaScript

    In this tutorial, you will learn about the tools JavaScript provides to merge, copy, convert, and filter arrays. Before you begin, however, it is important that I point out that while the instructor uses the terms "merge", "convert", "transform", and "filter", very rarely do these processes change an existing array. Instead, they create a new array that contains the merged, converted, transformed, and filtered data—leaving the original array in its unchanged and pristine format.

    5. Merge Arrays in JavaScript: With and Without Duplicates

    In this post, you'll learn how to combine multiple arrays into a single array in JavaScript. This is known as merging arrays. This is a simple problem that has multiple solutions. You will learn the most widely used and optimal ways of merging arrays.

    6. Remove Duplicates From an Array in JavaScript

    In this post, we're going to deal with a commonly needed functionality for arrays in JavaScript: how to remove duplicates. There are multiple ways of removing array duplicates, and you'll learn all of them in this tutorial.

    You'll learn how to remove duplicates from an array of primitives and how to remove duplicates from an array of objects the right way. 

    7. Iterating Over Arrays in JavaScript: 4 Methods Compared

    Iterating over or looping through arrays is something we have to do in almost every project that involves working with arrays. There are many reasons why you might need to loop over an array, such as showing the array data as an output or transforming it.

    There are many methods that you can use to iterate over arrays in JavaScript. In this tutorial, you will learn about them all while discovering the advantages or disadvantages of each in detail.

    8. Useful Array Methods in the Lodash Library

    While there are quite a few useful methods to work with Arrays in JavaScript, they are sometimes not enough to meet all our needs. You can save a lot of time by using a library like Lodash that offers a huge set of methods that implement common functionality missing from native JavaScript methods.

    In this tutorial, you'll discover some interesting methods defined in Lodash that you can start using right away. All you need to do to get started is load the library in your project from any CDN.

    9. Working With 2D Arrays in JavaScript

    In this tutorial, you'll learn how to work with 2D arrays in JavaScript. JavaScript doesn't have built-in support for 2D arrays. This is not a big issue because arrays in JavaScript can contain other arrays as their elements. This means that we can create 2D arrays in JavaScript by creating an array of arrays.

    Let's review some of the basics such as 2D array initialization and then implement additional functionality like getting and setting element values in a 2D array.

    Advertisement
    Did you find this post useful?
    Want a weekly email summary?
    Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
    Looking for something to help kick start your next project?
    Envato Market has a range of items for sale to help get you started.