4
這裏返回的錯誤是有問題的代碼:「意外令牌」語法對象箭頭功能
const data =
results.responses.map((response, idx) =>
{ id: idx+1,
name: response.name,
email: response.email,
comment: response.comment
}
)
我使用巴貝爾翻譯的ES6代碼爲JavaScript。這是錯誤信息:
Module build failed: SyntaxError: /Users/antkong/dev/project/form.js: Unexpected token (60:14)
58 | results.responses.map((response, idx) =>
59 | { id: idx+1,
> 60 | name: response.name,
| ^
61 | email: response.email,
62 | comment: response.comment
63 | }
爲什麼會出現語法錯誤?