Wednesday, 27 October 2021

javascript

 //find method returns the first element in an array which meets

// a condition

let numbers = [-1,-2,-4,-6,0,1,2,3,4,5];

const greaterThanZero = (val) => val > 0;

numbers.find(greaterThanZero); 

//Expected output 

//1


//filter returns an array of elements that meet a condition

numbers.filter(greaterThanZero);

//Exected output.

click here

No comments:

Post a Comment

c#

 https://github.com/dcyuksel/Result