Answers for "check is array in js"

21

if object is array javascript

Array.isArray(object);
Posted by: Guest on April-08-2020
9

javascript check if is array

var colors=["red","green","blue"];

if(Array.isArray(colors)){
    //colors is an array
}
Posted by: Guest on July-22-2019
3

js check if array

Array.isArray([1, 2, 3]);	// true
Array.isArray('asdf');		// false
Posted by: Guest on July-19-2020
1

js test if array

if(Array.isArray(myVarToTest)) {
	// myVatToTest is an array
} else {
	// myVarToTest is not an array
}
Posted by: Guest on September-02-2020
2

how to check if something is array javascript

function isArray(value) {
    return Object.prototype.toString.call(value) === "[object Array]";
}
Posted by: Guest on May-06-2020
0

how to check if array

// Check if something is an Array 
// just like you do with "typeof"
Array.isArray([1, 2, 3]);	// true
Array.isArray('asdf');		// false
Posted by: Guest on October-14-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language