2. What are callbacks?
4. What is the use of void (0)?
Example: 1 == "1" returns true because the string "1" is implicitly coerced to the number 1 before the comparison.
Triple Equals (===): This is the strict equality operator. It compares two values for equality without performing type coercion. If the values are of different types, the comparison will immediately return false. It’s generally recommended to use === over == in most situations in order to avoid unexpected results due to type coercion.
Example: 1 === "1" returns false because no type of coercion is performed, and a number is not strictly equal to a string.
0 and -0
"" (empty string)
10. Explain the differences between Promises and async/await.
Promises: Introduced in ES6, a Promise represents a future value — either a resolved value or a reason for rejection. Promises have three states: pending, resolved (fulfilled), or rejected. Promises are usually used with .then() for resolved values and .catch() for errors.
async/await: Introduced in ES8 (or ES2017), async/await is syntactic sugar on top of Promises, designed to make asynchronous code look and behave more like synchronous code. An async function always returns a promise, and inside an async function, you can use the await keyword to pause the function’s execution until the promise is resolved, making it easier to read and write asynchronous code.
Twenty curated interview questions from experts
Multiple solutions for each question
Advanced ways of manipulating data, which is something that interviewers look for.