Animations
API
Arrays
Async
Basics
Challenges
Classes
Console
Dates
Debugging
DOM Elements
DOM Methods
DOM Properties
Event Listeners
Flow Control
Forms
Functions
Global Functions
JSON
Keywords
Libraries (3rd party)
Math
Modules
Objects
Snippets
String
Types
Widgets
Window Object
https://www.w3schools.com/jsref/jsref_obj_array.asp
The some()
method checks if any of the elements in an array pass a test (provided as a function). The difference between this
and something like .map()
or find()
is that some()
returns a Boolean. True if any of the elements in the array pass the test,
otherwise it returns false. Think of it as a "contains" function.
The some()
method executes the function once for each element present in the array.
some()
does not execute the function for empty arrays.
some()
does not change the original array.
$(function ()
{
let hasClarke = authors.some((author) => { return author.name.toLowerCase() === "arthur c clarke" });
$("#demo1").html("Did we find Arthur C Clarke? " + hasClarke);
});