Created
February 2, 2021 14:41
-
-
Save Shariar-Hasan/a030e1a219c7ccbb642ffdbb0ac60ee3 to your computer and use it in GitHub Desktop.
use of map,filter,find methods in array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let numbers = [1,2,3,4,5,6,7,8,9,10]; | |
let result1 = numbers.map( (x) => x*10 ); | |
console.log(result1); | |
let result2 = numbers.filter( (x) => x%2 ); //returns all values that meet the condition | |
console.log(result2); | |
let result3 = numbers.find( (x) => x%2 && x>4); //returns only one value that meet the condition | |
console.log(result3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment