JavaScript Keywords

JavaScript statements often start with a keyword to identify the JavaScript action to be performed.

Here is a list of some of the keywords you will learn about in this tutorial:

KeywordDescription
BreakTerminates a switch or a loop
continueJumps out of a loop and starts at the top
debuggerStops the execution of JavaScript, and calls (if available) the debugging function
do … whileExecutes a block of statements, and repeats the block, while a condition is true
ForMarks a block of statements to be executed, as long as a condition is true
functionDeclares a function
if … elseMarks a block of statements to be executed, depending on a condition
ReturnExits a function
SwitchMarks a block of statements to be executed, depending on different cases
try … catchImplements error handling to a block of statements
varDeclares a variable