I’m getting the error “Uncaught SyntaxError: Unexpected token =>
” on my console when I put the e
parameter in parentheses and then use an ES6 arrow function. However, there’s no error when I remove the parameter from the parentheses. Should the parameter not have parentheses?
document.querySelector("#book-form").addEventListener("submit", (e)
=> {
// …
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…