findIndex() in JS

findIndex() in JS



<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>findIndex() in JS</title>



</head>
<body>
<script>

var arr1 = [1,2,3,4,5];
console.log(arr1);

var b= arr1.find(test);
console.log(b);

function test(x)
{
return x > 2;
}

</script>
</body>
</html>




Comments

Popular posts from this blog