Home / Javascript Tips Generated By ChatGPT / Dynamic Property Names in Objects in Javascript Use square brackets to set object properties with dynamic names. Source Code let propertyName = 'name'; let person = { [propertyName]: 'John' }; console.log(person.name);