filmov
tv
Array find and findIndex Methods in JavaScript | JavaScript Array Methods | Beginners tutorial
Показать описание
🎁 Join my channel to get access to perks:
🧡 Hello All JavaScript Lovers Outhere!
Today you're going to learn about the Array Object In JavaScript.
This tutorial is a series of videos, in each video we will discuss a method (or more) of the Array Object in JavaScript.
In today's video, you're going to learn about the find and findIndex methods.
------------------------------------------------- find ----------------------------------------------------------------------------------------
The find() method returns the value of the first element that passes a test.
The find() method executes a function for each array element.
The find() method returns undefined if no elements are found.
The find() method does not execute the function for empty elements.
The find() method does not change the original array.
🔷 Syntax :
// Callback function
find(callbackFn)
find(callbackFn, thisArg)
// Inline callback function
find(function(element) { /* … */ })
find(function(element, index) { /* … */ })
find(function(element, index, array){ /* … */ })
find(function(element, index, array) { /* … */ }, thisArg)
🔹callbackFn : Function to execute on each element.
The function is called with the following arguments:
🔹element : The current element being processed in the array.
🔹index : The index of element in the array.
🔹array : The array forEach() was called upon.
🔹thisArg (Optional) : Value to use as this when executing callbackFn.
------------------------------------------------- findIndex ----------------------------------------------------------------------------------------
The findIndex() method executes a function for each array element.
The findIndex() method returns the index (position) of the first element that passes a test.
The findIndex() method returns -1 if no match is found.
The findIndex() method does not execute the function for empty array elements.
The findIndex() method does not change the original array.
🔷 Syntax :
// Callback function
findIndex(callbackFn)
findIndex(callbackFn, thisArg)
// Inline callback function
findIndex(function(element) { /* … */ })
findIndex(function(element, index) { /* … */ })
findIndex(function(element, index, array){ /* … */ })
findIndex(function(element, index, array) { /* … */ }, thisArg)
🔹callbackFn : Function to execute on each element.
The function is called with the following arguments:
🔹element : The current element being processed in the array.
🔹index : The index of element in the array.
🔹array : The array forEach() was called upon.
🔹thisArg (Optional) : Value to use as this when executing callbackFn.
🌍 Social Media Links.
💲 Suppport the Channel
🧡 Hello All JavaScript Lovers Outhere!
Today you're going to learn about the Array Object In JavaScript.
This tutorial is a series of videos, in each video we will discuss a method (or more) of the Array Object in JavaScript.
In today's video, you're going to learn about the find and findIndex methods.
------------------------------------------------- find ----------------------------------------------------------------------------------------
The find() method returns the value of the first element that passes a test.
The find() method executes a function for each array element.
The find() method returns undefined if no elements are found.
The find() method does not execute the function for empty elements.
The find() method does not change the original array.
🔷 Syntax :
// Callback function
find(callbackFn)
find(callbackFn, thisArg)
// Inline callback function
find(function(element) { /* … */ })
find(function(element, index) { /* … */ })
find(function(element, index, array){ /* … */ })
find(function(element, index, array) { /* … */ }, thisArg)
🔹callbackFn : Function to execute on each element.
The function is called with the following arguments:
🔹element : The current element being processed in the array.
🔹index : The index of element in the array.
🔹array : The array forEach() was called upon.
🔹thisArg (Optional) : Value to use as this when executing callbackFn.
------------------------------------------------- findIndex ----------------------------------------------------------------------------------------
The findIndex() method executes a function for each array element.
The findIndex() method returns the index (position) of the first element that passes a test.
The findIndex() method returns -1 if no match is found.
The findIndex() method does not execute the function for empty array elements.
The findIndex() method does not change the original array.
🔷 Syntax :
// Callback function
findIndex(callbackFn)
findIndex(callbackFn, thisArg)
// Inline callback function
findIndex(function(element) { /* … */ })
findIndex(function(element, index) { /* … */ })
findIndex(function(element, index, array){ /* … */ })
findIndex(function(element, index, array) { /* … */ }, thisArg)
🔹callbackFn : Function to execute on each element.
The function is called with the following arguments:
🔹element : The current element being processed in the array.
🔹index : The index of element in the array.
🔹array : The array forEach() was called upon.
🔹thisArg (Optional) : Value to use as this when executing callbackFn.
🌍 Social Media Links.
💲 Suppport the Channel
Комментарии