question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Array with objects

See original GitHub issue

What’s prefered?

const x = [{
  y: 'foo',
  z: 'bar',
}, {
  y: 'foo',
  z: 'bar',
}]

or

const x = [
  {
    y: 'foo',
    z: 'bar',
  },
  {
    y: 'foo',
    z: 'bar',
  },
]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ljharbcommented, Jun 23, 2016

Either seem acceptable to me.

0reactions
ljharbcommented, Sep 7, 2016
const x = [
  {
    y: 'foo',
    z: 'bar',
  },
  {
    y: 'foo',
    z: 'bar',
  },
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript Array of Objects Tutorial – How to Create, Update ...
Arrays of objects don't stay the same all the time. We almost always need to ... To add an object at the first...
Read more >
Data Structures: Objects and Arrays - Eloquent JavaScript
Objects and arrays (which are a specific kind of object) provide ways to group several values into a single value. Conceptually, this allows...
Read more >
How to Create Array of Objects in Java? - GeeksforGeeks
An Array of Objects is created using the Object class, and we know Object class is the root class of all Classes. We...
Read more >
JavaScript Arrays - W3Schools
Arrays are a special type of objects. The typeof operator in JavaScript returns "object" for arrays. But, JavaScript arrays are best described as...
Read more >
Array - JavaScript - MDN Web Docs
The Array object, as with arrays in other programming languages, enables storing a collection of multiple items under a single variable name ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found