Why do we store timeoutId? What will happen if the Promise resolves before the timeout, and then the setTimeout with reject is triggered?
Frontend
How to get the width of a DOM element and track its changes? Can you attach a resize event to a DOM element using addEventListener?
How do cookies differ from localStorage? What is the maximum size of cookies and localStorage? How does their lifetime differ?
How does git merge differ from git rebase? What are the advantages and disadvantages of each approach?
Как можно решить задачу withTimeout альтернативным способом — через Promise.race? Что такое Promise.race, чем отличается от Promise.all?
Write a custom React hook useScreenWidth(targetWidth) that returns the current screen width (screenWidth) and a flag isMobile (true if the current width is less than targetWidth). The hook should update when the window size changes.
What is prop drilling? How many levels of nesting are considered acceptable?
Create a function that rejects the returned promise, passing the string "timeout_error" as the error, if it does not resolve within the specified timeout, or behaves normally as the original. @param {Promise} promise the original promise @param {Number} timeoutMilliseconds the timeout duration in milliseconds @return {Promise} a promise with the desired behavior function withTimeout(promise, timeout) { return new Promise((res, rej) => { const timeoutId = setTimeout(() => { rej("timeout_error") }) }) }
What other React hooks do you know? Tell about useRef, useReducer, useCallback, useMemo, useContext.
What is async/await? How does it differ from Promise?
What are var, let, const? How do they differ? What is hoisting?
Why did Redux Toolkit not suit you, and you switched to Effector?
What is NaN? Provide examples when NaN occurs. How to check if a value is NaN?
What is the difference between == and ===?
Tell us a little about yourself, your relevant experience, and what you are most proud of in your projects.
What is a higher-order function? Provide examples of built-in higher-order functions in JavaScript.
What HTTP methods do you know? How does PUT differ from PATCH?