Get to know MDN better
The if statement executes a statement if the last item on the stack is true (non-zero). If the condition is false (0), another statement can be executed.
To leave return values on the stack, add the result statement.
| if | 0x04 |
| else | 0x05 |
This page was last modified on Nov 23, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.