![]() |
VOOZH | about |
The Array.some() method in TypeScript is used to check if at least one element in the array passes the test implemented by the provided function.
Syntax:
array.some(callback[, thisObject])Parameter: This method accepts two parameters as mentioned above and described below:
Return Value: This method returns true if some element in this array satisfies the provided testing function.
The below example illustrates the Array some() method in TypeScriptJS:
In this example, the some() method checks if there is at least one positive number in the array.
Output:
trueIn this example, the some() method checks if there is at least one string with a length greater than 5.
Output:
true