Javascript Flashcards Preview

Interview - C# > Javascript > Flashcards

Flashcards in Javascript Deck (2)
Loading flashcards...
1

How do you add an item to an array?

var myArray = ['a', 'b', 'c', 'd'];

myArray.push("end");

2

How do you add an item to the beginning of an array?

var myArray = ['a', 'b', 'c', 'd'];

myArray.unshift("start");