What is the usage of some() method in JavaScript?

To add a test for the elements of the array, such as checking voter age, etc, then use the JavaScript some() method.


You can try to run the following code to learn how to work with some() method in JavaScript.

<!DOCTYPE html>
         var voter_ages = [17, 15, 19, 16, 20];
            function voterAge(myAge) {
               return myAge >= 18;
            document.write("Minimum Voter Age in the list: "+voter_ages.some(voterAge));