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.

Question about Object in Arrays

See original GitHub issue

I did not found any style definitions about object in arrays. Which one of the following is preferred?

const someArray = [{
  one: 'value',
  two: 'value',
}, {
  one: 'value',
  two: 'value',
}];

or

const someArray = [
  {
    one: 'value',
    two: 'value',
  },
  {
    one: 'value',
    two: 'value',
  },
];

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dani-sccommented, Mar 15, 2017

The second one has the advantage that it leads to cleaner git diffs when adding additional objects.

0reactions
JPeer264commented, Mar 16, 2017

Alright I will do an PR 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

5.1 Syntax questions for arrays and objects - Codecademy
Can somebody please clarify the following two questions… (1) When defining the object array 'players', does it matter if it is defined with...
Read more >
Object Array Questions and Answers - Sanfoundry
Object Oriented Programming using C++ Questions and Answers – Object Array · 1. What is an array of objects? · 2. Which among...
Read more >
Practice questions of Cpp - Array of objects - CodesDope
Practice questions on Array of objects​​ 1. Write a program to print the name, salary and date of joining of 10 employees in...
Read more >
Top 50 Array Interview Questions and Answers (2022)
1) What do you mean by an Array? Array is a set of similar data type. Arrays objects store multiple variables with the...
Read more >
Storing quiz questions in array of objects - javascript
Quiz loop through the all questions array and print the question and the options for user to choose from.
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