8 Must Know JavaScript Array Methods 1691814243
8 Must Know JavaScript Array Methods 1691814243
8 Must-Know
JavaScript Array
Methods
@nacercodes
001
.forEach()
Executes a provided function once for each array
element.
emojis.forEach(emoji => {
})
Console
I love
I love
I love
@nacercodes
002
.map()
Creates a new array populated with the results of
calling a provided function on every element.
})
console.log(result)
Console
@nacercodes
003
.filter()
Creates a new array with all elements that pass the
test implemented by the provided function.
const emojis = [' ', ' ', ' ', ' ']
})
console.log(pet)
Console
@nacercodes
004
.concat()
Creates a new array by merging two or more arrays.
console.log(result)
Console
@nacercodes
005
.find()
Returns the value of the first array element that
satisfies the provided test function, or undefined if
none does.
const emojis = [' ', ' ', ' ', ' ']
})
console.log(moon)
Console
@nacercodes
006
.push()
Adds the specified elements to the end of an array.
emojis.push(' ')
console.log(emojis)
Console
@nacercodes
007
.pop()
Removes the last element from an array and returns it.
console.log(lastEmoji)
console.log(emojis)
Console
@nacercodes
008
.includes()
Determines whether an array includes a certain value
or not.
console.log(hasSun)
console.log(hasStar)
Console
true
false
@nacercodes
Nacer Codes
@nacercodes