⤴️return
🚧 施工中
JS ⟩ statement ⟩ control flow ⟩ jump ⟩ return
return statement can be used only within the body of a function, using it anywhere else causes a SyntaxError.
return is affected by automatic semicolon insertion❗
⚠️ 注意:用 return 時,不要寫成這樣:
return
a + b;❌ 這種寫法 return 後面會被自動加上 ";" 分號❗
return; // 自動加上「;」分號❗️
a + b;✅ 建議寫成這樣:
return (
a + b
);return is a reserved word.
Last updated
Was this helpful?