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
  • 4

1 Answers1

0

Looking for computed property names?

const obj = { car : "a" , bus: "b" };
    const x = "a" ;
obj[x] = "some value"
Tushar Shahi
  • 16,452
  • 1
  • 18
  • 39