0% found this document useful (0 votes)
14 views

JavaScript_Glossary

Uploaded by

uzair.feeroze
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

JavaScript_Glossary

Uploaded by

uzair.feeroze
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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) { console.log('x is large');
Use } strict comparison (===) to a

for loop Iterate over arrays or ranges. for (let i = 0; i < arr.length; i++) { Use
console.log(arr[i]);
modern iteration } methods l

Arrow Functions Define concise functions. const add = (a, b) => a + b; Avoid using arrow functions for

Array.push() Add an element to the end of anarr.push(10);


array. Avoid mutating arrays in functio

try/catch Handle errors gracefully. try { riskyOperation(); } catch (e)Log


{ console.error(e);
errors for debugging
} and pr

fetch() Make HTTP requests. fetch('https://api.example.com').then(res


Use async/await
=> res.json());
for better reada

this Refers to the current context. function sayHi() { console.log(this.name);


Understand
} binding to avoid con

Destructuring Extract values from arrays/objects.


const {name} = user; Use for clean and readable cod

You might also like