What is array isarray in javascript?

 Array isarray method javascript:

 

Array.isArray() method check that this object is an Array or not.

Syntax of Array.isArray method:

Array.isArray(array)

 

isarray example in javascript:

 

const colors = ["Red", "blue", "Black", "Orange", "White"];

console.log(Array.isArray(colors));

// true

 

const colorNew = "Red";

console.log(Array.isArray(colorNew));

// false

 

const colorMore = {name:"Sheo", contact:"9396928562"};

console.log(Array.isArray(colorMore));

// false

 


No comments:

Note: Only a member of this blog may post a comment.

Copyright Reserved to Anything Learn. Powered by Blogger.