Answers for "array is an object in javascript"

9

Javascript is object array

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

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

array or object javascript

To remember the difference, you can think of "is a / has a" 

let fruits = [
  orange, 
  mango, 
  banana
];
// Every item in the array "fruits" is a fruit. 

let fruit = {
  seed:{}, 
  endocarp:{}, 
  flesh:{}
};
// The object fruit has every attribute inside the object.
Posted by: Guest on July-26-2021
0

javascript is array or object

const data = [1,2,3,4,5];const isArray = Object.prototype.toString.call(data) === '[object Array]';console.log(isArray); // trueconst data = {id: 1, name: “Josh”};const isArray = Object.prototype.toString.call(data) === '[object Array]';console.log(isArray); // false
Posted by: Guest on April-27-2021

Code answers related to "array is an object in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language