JavaScript Basics Cheat Sheet
Covering the basics and basic syntax of JavaScript Code
API: /api/v1/cheatsheet/javascript-basics-cheat-sheet
1. Variables & Declarations
⧉
1 2 3 | |
- const ≠ immutable (objects can still change)
- Always prefer const → fallback to let
2. Data Types
Primitive: string, number, boolean, null, undefined, symbol, bigint
Reference: object, array, function
⧉
1 2 | |
3. Operators
Arithmetic: + - * / % **
Comparison: - == // loose (avoid) - === // strict (preferred) - != !== > < >= <=
Logical: - && || ! - Nullish / Optional - a ?? b // null/undefined fallback - obj?.x // safe access
4. Control Flow
If / Else
⧉
1 2 3 4 5 6 7 | |
Switch
⧉
1 2 3 4 | |
Ternary: const result = condition ? a : b;
5. Loops
⧉
1 2 3 4 5 6 7 8 | |
6. Functions
Declaration
⧉
1 2 3 | |
Arrow Function
⧉
1 | |
Default Parameters
⧉
1 | |
Rest Parameters
⧉
1 | |
7. Objects
⧉
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
8. Arrays
⧉
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
9. Spread & Rest
⧉
1 2 3 4 | |
10. Asynchronous JavaScript
⧉
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
11. Fetch API
⧉
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
13. Error Handling
⧉
1 2 3 4 5 6 7 | |
14. Type Conversion
⧉
1 2 3 | |
--
15. Equality Rules
⧉
1 2 | |
Use === always unless you need coercion
16. Useful Built-ins
⧉
1 2 3 4 5 6 7 8 9 10 11 12 | |
17. Modules (ESM)
⧉
1 2 3 4 5 6 7 | |
18. Scope
- var → function scope
- let, const → block scope
⧉
1 2 3 | |
19. this Keyword
- Object method → object
- Arrow function → inherited (lexical)
- Global → window (browser) / undefined (strict mode)
20. Quick Reference
- let / const
- === (strict)
- => (arrow function)
- ... (spread/rest)
- ?. (optional chaining)
- ?? (nullish coalescing)
- async/await
- map/filter/reduce
Join the Newsletter
Practical insights on Django, backend systems, deployment, architecture, and real-world development — delivered without noise.
Get updates when new guides, learning paths, cheat sheets, and field notes are published.
No spam. Unsubscribe anytime.
There is no third-party involved so don't worry - we won't share your details with anyone.