codesandbox-client icon indicating copy to clipboard operation
codesandbox-client copied to clipboard

If you add a comma after the property of the object, it creates a new object.

Open kaori-killer opened this issue 2 years ago • 0 comments

🐛 bug report

Preflight Checklist

  • [x] I have read the Contributing Guidelines for this project.
  • [x] I agree to follow the Code of Conduct that this project adheres to.
  • [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

Description of the problem

If you add a comma after the property of the object, it creates a new object.

How has this issue affected you? What are you trying to accomplish?

Object B refers to object A. However, due to commas, object A and object B have become completely different objects.

To Reproduce

Link to sandbox: link (optional)

const initialPosition = {
  x: 0,
  y: 0
};

Replace the code above with the code below.

const initialPosition = {
  x: 0,
  y: 0,,,,
};

And if I change it to the code below

const initialPosition = {
  x: 0,
  y: 0
};

The object seems to be newly created.

Your Environment

Software Name/Version
Сodesandbox https://codesandbox.io/s/swimpyobeogeu-9fxd5h?file=/App.js
Browser Brave
Operating System MacOS

kaori-killer avatar Jul 23 '23 04:07 kaori-killer