Curriculum
Course: JavaScript Basic
Login

Curriculum

JavaScript Basic

JSHome

0/216
Text lesson

Explanation

If a statement is incomplete, like this:

let

JavaScript will attempt to complete the statement by reading the next line.

power = 10;

But since this statement is incomplete:

return

JavaScript will automatically close it like so:

return;

This occurs because ending statements with a semicolon is optional in JavaScript.

JavaScript will close the return statement at the end of the line, as it recognizes it as a complete statement.