### Frontend Screening Interview Questions --- #### Q. How do you check if a variable holds an array? ###### A. Using `Array.isArray` function. --- #### Q. How would you generate a long string of a single character? ###### A. Using `String.repeat` function. Example, `'M'.repeat(255);` will generate 255 `M` characters in a single string --- #### Q. Is `Promise` constructor `async` like `setTimeout` or `sync`? ###### A. It is `sync`. --- #### Q. What is the difference between `Function.call` and `Function.bind`? ###### A. `Function.bind` returns a new function with bounded arguments, while `Function.call` just calls the function with the given arguments. --- #### Q. What is the difference between `Function.reduce` and `Function.map`? ###### A. `Function.reduce` acts like a collection aggregator while `Function.map` just returns a new array probably after performing some calculation on the original array's elements. --- #### Q. When would you opt for using `Map` instead of a simple `object`? ###### A. If we have constantly changing object then we would use `Map` for its high performance, while for static objects a simple `object` would work. --- #### Q.When do `useMemo` and `useEffect` run in a component life cycle? ###### A. `useMemo` runs before a component renders while `useEffect` runs after component has rendered and is mounted in the browser DOM. --- #### Q. Would you choose React `Context` to store the application data or a state manager? ###### A. Use a state manager always, `Context` is used only for light weighted information sharing. --- #### Q. What are the advantages of `CSS-in-JS` and `CSS Modules` over the standard CSS in React? ###### A. These solutions scope the CSS thus a developer is free to use same CSS rule name across the project without having a name collision and rules overriding.