| Statement | Example |
|---|---|
| ExpressionStatement | a + b; |
| BlockStatement | { let x = 1; let y = 2; } |
| IfStatement | if (x>0) { y=1; } else { y=2; } |
| SwitchStatement | switch(x){ case 1: y=1; break; default: y=0; } |
| ForStatement | for(let i=0;i<3;i++){ console.log(i); } |
| WhileStatement | while(x<5){ x++; } |
| DoWhileStatement | do { x++; } while(x<5); |
| ThrowStatement | throw new Error("oops"); |
| TryCatchFinally | try { risky(); } catch(e){ console.log(e); } finally { cleanup(); } |
| Declaration | Example |
|---|---|
| VariableDeclaration | let x=0; const y=1; var z; |
| FunctionDeclaration | function f(a){ return a+1; } |
| ClassDeclaration | class A { constructor(x){ this.x=x; } } |
| Expression | Example |
|---|---|
| AssignmentExpression | a = 5; |
| BinaryExpression | a + b |
| UnaryExpression | !a, -b |
| LogicalExpression | a && b, a || b |
| ConditionalExpression | a ? b : c |
| CallExpression | f(3) |
| MemberExpression | obj.prop, arr[0] |
| ObjectExpression | { a:1, b:2 } |
| ArrayExpression | [1,2,3] |
| FunctionExpression | const f = function(){} |
| ArrowFunctionExpression | const f = () => {} |
| TemplateLiteral | `Hello ${name}` |
| Object | Example |
|---|---|
| Object | const o = {a:1}; |
| Function | function f(){} |
| Boolean | let b = true; |
| Symbol | const s = Symbol('id'); |
| Error | throw new Error('oops'); |
| BigInt | 12345678901234567890n; |
| Object | Example |
|---|---|
| Number | Number('123'); |
| BigInt | BigInt(123); |
| Math | Math.max(1,5); Math.random(); |
| Date | new Date(); |
| Object | Example |
|---|---|
| String | 'abc'.toUpperCase(); |
| RegExp | /abc/.test('abc'); |
| TemplateLiteral | `Value: ${x}` |
| Object | Example |
|---|---|
| Array | [1,2,3].map(x=>x*2); |
| Typed Arrays | new Uint8Array([1,2,3]); |
| Object | Example |
|---|---|
| Map | const m = new Map(); m.set('a',1); |
| Set | const s = new Set([1,2]); |
| WeakMap | const wm = new WeakMap(); |
| WeakSet | const ws = new WeakSet(); |
| Object | Example |
|---|---|
| JSON | JSON.stringify({a:1}); JSON.parse('{"a":1}'); |
| ArrayBuffer / DataView | new ArrayBuffer(16); new DataView(buf); |
| Object | Example |
|---|---|
| Promise | Promise.resolve(5).then(console.log); |
| GeneratorFunction / Generator | function* g(){ yield 1; } |
| AsyncFunction | async function f(){ await fetch('/'); } |
| Object | Example |
|---|---|
| Proxy | const p = new Proxy({}, {}); |
| Reflect | Reflect.get(obj,'prop'); |
| Object | Example |
|---|---|
| Intl.Collator | new Intl.Collator('en').compare('a','b'); |
| Intl.NumberFormat | new Intl.NumberFormat('en-US').format(12345); |
| Intl.DateTimeFormat | new Intl.DateTimeFormat('en').format(new Date()); |
| Object | Example |
|---|---|
| console | console.log('hello'); |
| globalThis | globalThis.x = 1; |
| eval | eval('2+2'); |
| parseInt / parseFloat | parseInt('42'); parseFloat('3.14'); |