JS isArray

 
<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    var a = ["Sanjay", "Aman", "Rehman"];
    document.write(a + "<br><br>");
    var b = Array.isArray(a);
    document.write(b);
  </script>
</head>
<body>

</body>
</html>


isArray() with if condition

<!DOCTYPE html>
<html>
<head>
  <title>JavaScript</title>
  <script>
    var a = ["Sanjay", "Aman", "Rehman"];
    if(Array.isArray(a)){
        document.write("This is an Array"); 
    }else{
        document.write("This is not an Array");  
    }
  </script>
</head>
<body>
</body>
</html>