find() in JS

Find() 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>Find method in array</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