Javascript Array Helper Methods Flashcards
1
Q
Joins two or more arrays and returns a copy of the joined arrays?
A
.concat()
2
Q
Copies array elements within the array, to and from specified positions?
A
var fruits = [“Banana”, “Orange”, “Apple”, “Mango”, “Kiwi”, “Papaya”];
fruits. copyWithin(2,0,2);
results: Banana,Orange,Banana,Orange,Kiwi,Papaya
3
Q
Checks if every element in array passes a test?
A
every() var ages = [32, 33, 16, 40];
function checkAdult(age) { return age >= 18; }
function myFunction() { document.getElementById("demo").innerHTML = ages.every(checkAdult); } returns false