showing results for - "javascript array vs object"
Phil
08 Nov 2016
1// A list of ordered strings is a good case for an array:
2const sortedNames = ['Axl', 'Billie', 'Chuck'];
3// An item with named properties is a good case for an object:
4const box = { height: 4, width: 3, color: 'blue' };
5
6// Two types of collections
7// Arrays and objects are two ways of collecting data into a group. 
8// The data can be primitives (strings, numbers, booleans):
9const namesArr = ['Danny', 'Donny', 'Joey', 'Jordan', 'Jonathan'];
10const userObj = { name: 'Jamie', age: 42 };
11// …or they can be made of other arrays or objects:
12const usersArr = [{ name: 'Jim', age: 4 }, { name: 'Al', age: 62 }];
13const miscObj = { colors: ['orange', 'red'], numbers: [1, 2, 3] };
queries leading to this page
js object of objects vs array of objectsarray 285 29 vs objectarray vs object in jsarray object vs arrayjs array vs objectarray and object difference in javascriptnodejs array vs objectarrays vs objects javascriuptobject vs array jsdiff between array vs array of object in javascriptwhen to use array vs object in javascriptobject vs array in javascriptarray like object vs objectjavascript object vs arrayjs array vs array of objectsarray vs object in javascriptobject vs array find in javascriptarray vs object programmingarrays vs objects in javascriptdifference between an array and an objectdifference en array et objects javascriptarray vs object javascriptjs object list vs arrayobjects vs arrays javascriptdifference between object and array in jsdifference between object and array in javascriptdiffernce object arrayjavascript objects vs arraysjavascript difference between array and objectarray vs object differencejs detect array vs objectarray vs object array vs obj in jsobject vs array in jsdifference between array and object in javascriptarrays vs objects javascriptjavascript array vs objectarray vs object jshow to tell the difference between object and array in javascriptjs arrays vs objectsdifference between object and arraydifference between object and array jsdifference between array and object javascriptarray versus object javascriptnode js array vs objectarray vs objectdifference between javascript array and objectobject array vs array javascriptobjects vs arraysjavascript array vs array objectobjects vs arrays js difference between array and object in javascriptobject define vs array define in javascripthow to check an object vs array in javascriptarray vs objects in javascriptobject vs array javascriptobject vs arraymdn array vs objectwhat is the difference between array and object in javascriptdifference between object and array javascriptarray of object vs object of arraydifference between array and objectjs object vs arrayjavascript list vs array vs objectobject of object vs aray of objects javascriptjavascript array vs objectsobject array vs arraywhat is the difference between object and array in javascriptarray of single object vs objectobject js vs arraydifference in object and arrayjs object vs js array difference in js array and objectarray of objects vs object of arrayshow to identify array vs and object in javascriptarray and object differencejs distinguish array and objectwhat is difference between array and object in javascriptwhat is the difference between an array and an objectwhat is difference between object and array in javascriptdifference array and objectonject vs array in jsarray vs objectsdifference between array and object in jsjs difference between array and objectjs differences between array and objectjavascript efficient object vs arrayjavascript array vs object