Javascript Array Helper Methods Flashcards

1
Q

Joins two or more arrays and returns a copy of the joined arrays?

A

.concat()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly