Closed shivamrathi99 closed 3 years ago
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
const array1 = [5, 12, 8, 130, 44]; const isLargeNumber = (element) => element > 13; console.log(array1.findIndex(isLargeNumber));
This code snippet can be shown like this:
const array1 = [5, 12, 8, 130, 44]; const isLargeNumber = array1.findIndex(element => element > 10); console.log(isLargeNumber);
it improves the readability
thanks
URL(s)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
Request type
Details
const array1 = [5, 12, 8, 130, 44]; const isLargeNumber = (element) => element > 13; console.log(array1.findIndex(isLargeNumber));
This code snippet can be shown like this:
const array1 = [5, 12, 8, 130, 44]; const isLargeNumber = array1.findIndex(element => element > 10); console.log(isLargeNumber);
it improves the readability
thanks