TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

JavaScript TypedArray some() Method

JavaScript TypedArray some() Method with example, join() method, javascript typedarray methods, keys() method, indexOf() method, includes() method, forEach() method, entries(), every(), find(), filter(), copyWithin() method etc.

<< Back to JAVASCRIPT

JavaScript TypedArray some() Method

The 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:

Chrome Yes
Safari Yes
Firefox Yes
Opera Yes

Example 1

JavaScript 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>
Test it Now

Output:

True

Example 2

JavaScript 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>
Test it Now

Output:

false





Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf