JavaScript Work Out - Arrays

JavaScript Work Out - Arrays

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

Access elements in an array

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (9)

Section 1

(9 cards)

Access elements in an array

Front

referring to the index number. var name = cars[0];

Back

Difference Between Arrays and Objects

Front

In JavaScript, arrays use numbered indexes. In JavaScript, objects use named indexes.

Back

Change Array Element

Front

cars[0] = "newValue";

Back

Add Element to Array Using length

Front

var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits[fruits.length] = "Lemon"; // adds a new element (Lemon) to fruits

Back

push method

Front

add a new element to an array

Back

Array Syntax

Front

var name = [item1, item2, ...];

Back

Array

Front

used to store multiple values in a single variable.

Back

Access Last Array Element

Front

var last = fruits[fruits.length - 1];

Back

length property

Front

returns the length of an array (the number of array elements).

Back