Program to use JavaScript Array some() method
function a(b) {
return b < 18;
}
let c = [44, 23, 37, 60, 75];
let d = c.some(a);
console.log(d);
Output
false
Steps Description
- Declare three variable
a, c
andd
- Initialize three variable with value of array
function a(b) { return b < 18;}, c = [44, 23, 37, 60, 75]
andd = c.some(a)
- Array
some()
method returns true if the statement given in the array is related to a single element of the array, otherwise it returns false. - The value of
b
variable is displayed with the help of console.log inbuilt function