C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript TypedArray some() MethodThe JavaScript some() method examines the elements of the array if they are satisfied on the given condition or not. The condition is checked by the argument function. Syntax:
array.some(function(value, index, arr), thisValue) Parameters:
Array: Thet array where the some() method is called. Index: index of the current value being processed by the method. Value: The value of the current element. ThisValue: The value to be given to the method used as this value. Return value:
It returns true value if the elements of the array pass the condition. If the elements not satisfy the condition then it return false. Browser Support:
Example 1JavaScript TypedArray some() Method.
<script>
// JavaScript to illustrate some() method
function JavaTpoint(element, index, array)
{
return element > 5;
}
function isMore()
{
// array
var array = [1,2,3,4,5,6,7,8,9];
// Checking for condition in array
var value = array.some(JavaTpoint);
document.write(value);
// expected output: arr[Output: True]
}
isMore();
</script>
Output: True Example 2JavaScript TypedArray some() Method.
<script>
// JavaScript to illustrate some() method
function JavaTpoint(element, index, array)
{
return element > 5;
}
function isMore()
{
// Original array
var array = [1,2,3,4];
// checking for condition in array
var value = array.some(JavaTpoint);
document.write(value);
// expected output: arr[Output:false]
}
isMore();
</script>
Output: false
Next TopicJavaScript TypedArray Object
|