| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Errors/Bad_return | [Back] [Original] |
Get to know MDN better
SyntaxError: Illegal return statement V8 SyntaxError: return not in function (Firefox) SyntaxError: Return statements are only valid inside functions. (Safari)
return return
function cheer(score) {
if (score === 147)
return "Maximum!";
}
if (score > 100) {
return "Century!";
}
}
// SyntaxError: return not in function
if {
function cheer(score) {
if (score === 147) {
return "Maximum!";
}
if (score > 100) {
return "Century!";
}
}
This page was last modified on 2025718 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |