0% found this document useful (0 votes)
33 views2 pages

JavaScript Interview Cheat Sheet

This JavaScript Interview Cheat Sheet covers essential topics including data types, variable scoping, functions, and DOM manipulation. It also addresses asynchronous programming concepts like Promises and async/await, as well as coding logic and miscellaneous concepts such as event delegation and memory management. The cheat sheet serves as a quick reference for key JavaScript principles and methods useful for interviews.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views2 pages

JavaScript Interview Cheat Sheet

This JavaScript Interview Cheat Sheet covers essential topics including data types, variable scoping, functions, and DOM manipulation. It also addresses asynchronous programming concepts like Promises and async/await, as well as coding logic and miscellaneous concepts such as event delegation and memory management. The cheat sheet serves as a quick reference for key JavaScript principles and methods useful for interviews.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Interview Cheat Sheet

Basic JavaScript
- Data Types: String, Number, Boolean, Null, Undefined, Object, Symbol, BigInt
- var vs let vs const: var is function-scoped, let/const are block-scoped. const can't be reassigned.
- Hoisting: JS moves declarations to the top before code runs.
- == vs ===: == compares value only, === compares value and type.
- Truthy vs Falsy: Truthy (e.g., 'hello'), Falsy (e.g., '', 0, null, undefined, NaN)

Functions & Scope


- Scope: Global (outside any function), Local (inside a function), Block (inside {} blocks)
- Closures: Functions that remember variables from their outer scope.
- Callback: Function passed as argument and executed later.
- this: Refers to the object calling the function.

Functions and Objects


- Function: function greet() { [Link]('Hello'); }
- Arrow Function: const sum = (a, b) => a + b;
- Object: const obj = { key: 'value' };
- Looping: for...of for arrays, for...in for objects.

Array & String Methods


- map: returns a new array, filter: filters items, forEach: just loops.
- splice vs slice: splice modifies original, slice returns a copy.
- reduce: reduces array to a single value.
- Remove Duplicates: [...new Set(arr)]
- String Methods: split(), trim(), toUpperCase(), etc.

DOM Manipulation
- DOM: Document Object Model (structure of webpage).
- Select: getElementById(), querySelector()
- Modify: [Link], [Link]
- Events: click, input, etc.
- Create/Remove: [Link](), appendChild()
Asynchronous JavaScript
- Sync vs Async: Sync waits, Async doesn’t.
- Promises: async code with then() and catch()
- async/await: cleaner way to handle Promises
- setTimeout/setInterval: delay and repeat execution
- fetch API: used to get data from server

Misc & Coding Logic


- null vs undefined: null = empty, undefined = not assigned
- Template Literals: `Hello, ${name}`
- Shallow vs Deep Copy: shallow = one level, deep = all levels
- Reverse String: [Link]('').reverse().join('')
- Prime Check: check if number divisible by any number less than it

Bonus Concepts
- Event Delegation: handle event from parent for child elements
- Debounce/Throttle: limit how often function runs
- Memory Management: JS clears unused data automatically
- Call Stack/Event Loop: stack runs sync, loop handles async
- Storage: localStorage (forever), sessionStorage (tab only), cookies (small, with expiry)

You might also like