Javascript Array.isArray()
method can determine if a given value is an array.
Consider the following example:
let colors = ["red", "blue", "green"]; if (Array.isArray(colors)){ console.log("is an array"); } let s = "css"; console.log(Array.isArray(s));/*from w ww . j a v a2 s . com*/