JavaScript Glossary
Syntax/Function Purpose Example Best Practice
let/const Declare variables (block-scoped).
let x = 5; const y = 10; Use const by default unless rea
if/else Control flow based on conditions.
if (x > 5) { [Link]('x is large');
Use } strict comparison (===) to a
for loop Iterate over arrays or ranges. for (let i = 0; i < [Link]; i++) { Use
[Link](arr[i]);
modern iteration } methods l
Arrow Functions Define concise functions. const add = (a, b) => a + b; Avoid using arrow functions for
[Link]() Add an element to the end of [Link](10);
array. Avoid mutating arrays in functio
try/catch Handle errors gracefully. try { riskyOperation(); } catch (e)Log
{ [Link](e);
errors for debugging
} and pr
fetch() Make HTTP requests. fetch('[Link]
Use async/await
=> [Link]());
for better reada
this Refers to the current context. function sayHi() { [Link]([Link]);
Understand
} binding to avoid con
Destructuring Extract values from arrays/objects.
const {name} = user; Use for clean and readable cod