Language/Javascript, typescript

[javascript] 변수로 object 키 설정

junha6316 2022. 3. 20. 13:32
const a = 'test'
const value = 123

const testObject = {}
testObject[a] = value

console.log(testObject)
// { test: 123}