Hoisting
Hoisting is JavaScript's default behavior of moving declarations to the top of the current scope before code execution.
Only declarations are hoisted, not initializations.
Interview Questions:
• What is hoisting in JavaScript and how does it work for variables vs functions?
• Does 'let' and 'const' get hoisted? Explain with an example.
Promises
Promises are objects representing the eventual completion or failure of an asynchronous operation. They have three
states: pending, fulfilled, and rejected.
Interview Questions:
• Explain the states of a Promise.
• How do you chain multiple promises?
Closures
A closure is created when a function retains access to its lexical scope, even when executed outside of its original
scope.
Interview Questions:
• What is a closure and why is it useful?
• Give a practical example of using closures.
CSS Grid
CSS Grid Layout is a two-dimensional layout system for the web, allowing you to create rows and columns easily.
Interview Questions:
• What is the difference between CSS Grid and Flexbox?
• How do you create a grid with equal columns?
Flexbox
Flexbox is a one-dimensional layout system for arranging items in rows or columns.
Interview Questions:
• What are the main axis and cross axis in Flexbox?
• Explain justify-content and align-items in Flexbox.
Debouncing
Debouncing ensures that a function is not called again until a certain amount of time has passed without it being
called.
Interview Questions:
• What is debouncing and when would you use it?
• How do you implement debouncing in JavaScript?
setTimeout
setTimeout schedules a function to run after a specified delay in milliseconds.
Interview Questions:
• Does setTimeout guarantee exact timing? Why or why not?
• How is setTimeout different from setInterval?
Throttling
Throttling ensures that a function is only called at most once in a specified time interval.
Interview Questions:
• What is throttling and how is it different from debouncing?
• Give a use case for throttling.
Async/Await
Async/Await is syntactic sugar for working with Promises, making asynchronous code look synchronous.
Interview Questions:
• How does async/await improve code readability over Promises?
• Can you use await outside of an async function?
Callbacks
A callback is a function passed as an argument to another function, to be executed later.
Interview Questions:
• What is a callback function?
• What is callback hell and how do you avoid it?
SEO
SEO (Search Engine Optimization) involves optimizing websites to rank higher in search engine results.
Interview Questions:
• What are some SEO best practices for frontend developers?
• How does page load speed impact SEO?
Deep Copy vs Shallow Copy
Shallow copy duplicates only the top-level properties, while deep copy duplicates all nested objects as well.
Interview Questions:
• How do you perform a deep copy in JavaScript?
• What are some pitfalls of shallow copying objects?
Map, Filter, Reduce
These are array methods: map transforms elements, filter returns matching elements, reduce accumulates values.
Interview Questions:
• Explain the difference between map and forEach.
• How does reduce work internally?
Spread Operator
The spread operator (...) expands iterable values into individual elements.
Interview Questions:
• How is the spread operator different from rest parameters?
• Give an example of using spread for object cloning.