The isArray in JavaScript :- Geniusofstudent

  • The isArray() method checks the given variable is array or not.
  • If the variable is an array this function returns true and otherwise returns false.
  • Syntax
    Array.isArray(variable);




  1. Code:-
<!DOCTYPE html> 
<html> 
 
<head> 
 <meta name="viewport" content="width=device-width, initial-scale=1"> 
</head> 
 
<body> 
 <h1>Array.isArray()</h1> 
 
 <h2>ar=[10,20,30]</h2> 
 
 <input type="button" onclick="ar_fun();" value="isArray()"> 
 
 <script> 
  function ar_fun() 
  { 
 
   var ar = [10, 20, 30]; 
   //Return array or not (true,false) 
   alert(Array.isArray(ar)); 
  } 
 </script> 
 
</body> 
 
</html>
The isArray in JavaScript :- Geniusofstudent The isArray in JavaScript :- Geniusofstudent Reviewed by Network security on July 11, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.