Question:Is there a way to declare a Object with the same key names in js ?
Answer:No. The names of the properties in an object must be unique, not least so you can identify the property you want to get/set. Although the code you wrote will parse and run, the resulting object will have only one property (the last one using that name):
You could use an array of objects if the key name must be the same:
let array = [1, 1, 1];) as the key name isn’t doing anything useful if it’s always the same.
If you have better answer, please add a comment about this, thank you!