What are closures in JavaScript?
Explain what closures are in JavaScript. Provide an example of when you would use a closure and explain how it works.
Meta (formerly Facebook) builds technologies that help people connect, including social media platforms, VR/AR, and the metaverse.
5
Questions in database
Explain what closures are in JavaScript. Provide an example of when you would use a closure and explain how it works.
What are the differences between useCallback and useMemo hooks in React? When would you use one over the other? Provide examples.
Build an infinite scroll component in React that efficiently loads and displays large lists of items. Consider virtualization.
Explain the concept of memoization. Implement a memoize function and discuss when memoization is beneficial vs harmful.
Implement Promise.all in JavaScript without using the built-in method. Handle success and failure cases correctly.