JavaScript Keywords & Reserved Words
Every JavaScript keyword grouped by category with one-line descriptions. Master these and your fingers will keep up with your ideas.
Declarations
| Keyword | Description |
|---|---|
var | Function-scoped variable declaration (legacy) |
let | Block-scoped mutable variable |
const | Block-scoped immutable binding |
Control Flow
| Keyword | Description |
|---|---|
if | Conditional branch |
else | Fallback branch |
for | Count-based or iterator loop |
while | Condition-checked loop |
do | Execute body then check condition |
switch | Multi-case conditional |
case | Match arm inside switch |
break | Exit loop or switch |
continue | Skip to next loop iteration |
return | Return a value from a function |
default | Fallback case in switch |
Functions & Async
| Keyword | Description |
|---|---|
function | Declare a function |
async | Mark a function as asynchronous |
await | Wait for a Promise to resolve |
yield | Pause a generator and produce a value |
yield* | Delegate to another generator or iterable |
Classes & Objects
| Keyword | Description |
|---|---|
class | Define a class |
extends | Inherit from a parent class |
super | Reference the parent class constructor/methods |
new | Instantiate an object |
this | Reference the current object context |
static | Declare a static class member |
Modules
| Keyword | Description |
|---|---|
import | Import bindings from a module |
export | Export bindings from a module |
default | Default export of a module |
from | Specify the module source |
as | Alias an import or export |
Error Handling
| Keyword | Description |
|---|---|
try | Begin a guarded block |
catch | Handle a thrown exception |
finally | Always-run cleanup block |
throw | Throw an exception |
Operators & Types
| Keyword | Description |
|---|---|
typeof | Return type string of an operand |
instanceof | Check prototype chain membership |
void | Evaluate expression and return undefined |
delete | Remove a property from an object |
in | Check if property exists in object |
of | Iterate over iterable values (for...of) |
TypeScript Adds More
TypeScript extends JavaScript with additional keywords: type, interface, enum, namespace, readonly, abstract, declare, and more. Practice typing TypeScript below.
Practice typing these in CodeSpeedTest →
Knowing keywords is not the same as having them in your muscle memory. Start with Hello World and build up to real-world JS patterns.
Frequently asked questions
How many reserved keywords does JavaScript have?
About 40, depending on the ECMAScript version and strict mode — including var, let, const, function, class, return, if, else, for, while, async and await.
What is the difference between var, let and const?
var is function-scoped and hoisted; let and const are block-scoped. const cannot be reassigned, though an object it points to can still change.
Can I use a reserved word as a variable name?
No — reserved words like class, return or new cause a syntax error as identifiers. They can be used as object property names.
Related language syntax references
- SQL Commands ReferenceEssential SQL commands from SELECT to window functions, grouped by category. Practice SQL typing with real query snippets.
- HTML Tags ReferenceAll semantic HTML5 elements organized by category — document structure, text, forms, media, and interactive elements.
- CSS Properties ReferenceEssential CSS properties grouped by category — layout, flexbox, grid, typography, colors, animations, and modern CSS features.
- React Interview Typing PracticeCore React patterns — hooks, component composition, state management — as typing drills for technical interviews.
- Java Syntax DrillJava keywords, OOP patterns, and collections framework reference. Practice typing Java code from Hello World to design patterns.
- C++ Syntax DrillModern C++ keywords, STL containers, smart pointers, templates, and lambdas — one compact reference for drilling C++ fluency.