Reprinted link: https://blog.csdn.net/lihefei_coder/article/details/82499520
// The first way var Key = 'name' ; var JSON = {}; JSON [Key] = 'zhangshan' ; the console.log (json.name); // second embodiment var Key = 'name' ; var JSON = { [Key]: 'zhangshan' }; the console.log (json.name);