0

is something like this is make able i tried to put the var in [] but it didn't worked also can any one help please thank you

const obj = { car : "a" , bus: "b" };
    const x = "car" ;
obj.x = "some value"
muhammad
  • 13
  • 3

1 Answers1

0

Looking for computed property names?

const obj = { car : "a" , bus: "b" };
    const x = "a" ;
obj[x] = "some value"
Tushar Shahi
  • 10,769
  • 1
  • 9
  • 29