There are JavaScript statements which are begin with a keyword to specify what JavaScript action to be performed. Keywords are words which cannot be used for any other purposes like naming variable, identifiers etc.
Some popular keywords of JavaScript are given here:
Sl.No. | Keyword | Description |
---|---|---|
1. | break | Used to Terminate a switch or a loop |
2. | continue | Used to Jump out of a loop and starts at the top |
3. | debugger | Used to stop the execution of JavaScript code , and calls the debugging function, if available |
4. | do ... while | Used to Execute a block of statements, and repeats it while the condition is true |
5. | for | Used to execute a block of statement as long as a condition is true |
6. | function | Used to Declare a function |
7. | if ... else | Used to execute a block of statements based on the condition |
8. | return | Used to exit a function |
9. | switch | Used to execute a block of statements based on the condition on different cases |
10. | try ... catch | Used for error handling to a block of statements |
11. | var | Used to Declare a variable |