Front/error
Invalid shorthand property initializer에러
JENN_tech7
2020. 11. 13. 09:51
728x90
SMALL
const user = {
id = 'abcdef',
name : 'Chiho Won',
data : [1,2,3,4],
}
const {id, name, data} = user
console.log(id)
console.log(name)
console.log(data)
SyntaxError: Invalid shorthand property initializer
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
=를 :로 바꿔줘야한다
id = 어쩌구를 :로 바꿔줬더니 잘 뜬다 ㅎㅎ
abcdef
Chiho Won
[ 1, 2, 3, 4 ]
728x90
LIST