briHalterman / basic-js-array-methods

Learned JavaScript array methods following Treehouse tutorial.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JavaScript Basic Array Methods

JavaScript Basic Array Methods

Author: Dustin Usey
Date: October 17, 2022

Arrays are used to store a collection of multiple items under a single variable name. This collection could be things like strings, numbers, or even a mix of different data types. Sometimes we need to update or manipulate our arrays by adding or removing items, or combining one array with another. In this guide, we’ll discuss some of the many basic JavaScript array methods.

Table of Contents

Introduction

JavaScript arrays are versatile data structures that allow you to store multiple values in a single variable. This guide covers some essential array methods that enable you to manipulate and work with arrays effectively.

JavaScript Arrays Course

To deepen your understanding of JavaScript arrays, you can check out the following resources:

Array Methods

.push()

The .push() method adds one or more elements to the end of an array.

.pop()

The .pop() method removes the last element from an array and returns that element.

.shift()

The .shift() method removes the first element from an array and returns that removed element.

.unshift()

The .unshift() method adds one or more elements to the beginning of an array.

.indexOf()

The .indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.

.toString()

The .toString() method converts an array to a string of comma-separated values.

.join()

The .join() method joins all elements of an array into a string, with an optional separator.

.concat()

The .concat() method combines two or more arrays.

Related Resources

Additional resources for specific methods:

For further exploration of JavaScript array methods, you can refer to the following resources:

Acknowledgements

Special thanks to Team Treehouse. Team Treehouse offers comprehensive courses on JavaScript and web development. Check out their JavaScript Arrays course for a deeper understanding of array manipulation in JavaScript.

About

Learned JavaScript array methods following Treehouse tutorial.


Languages

Language:JavaScript 100.0%