Q831. How do you check an object is a promise or not?
If you don't know if a value is a promise or not, wrapping the value as `Promise.resolve(value)` which returns a promise ```javascript function isPromise(object) { if (Pr...
Technical Question Bank · Peer-Reviewed
Search and filter frequently asked interview questions across technical, programming, and behavioral domains. Tailor your interview preparation by difficulty for freshers or experienced developers (963 available).
If you don't know if a value is a promise or not, wrapping the value as `Promise.resolve(value)` which returns a promise ```javascript function isPromise(object) { if (Pr...
The constructor is mainly used for two purposes, 1. To initialize local state by assigning object to this.state 2. For binding event handler methods to the instance For e...
You can use `new.target` pseudo-property to detect whether a function was called as a constructor(using the new operator) or as a regular function call. 1. If a construct...
No, it is not mandatory. i.e, If you don’t initialize state and you don’t bind methods, you don’t need to implement a constructor for your React component.
There are three main differences between arguments object and rest parameters 1. The arguments object is an array-like but not an array. Whereas the rest parameters are a...
You should not call `setState()` in `componentWillUnmount()` because once a component instance is unmounted, it will never be mounted again.
Rest parameter collects all remaining elements into an array. Whereas Spread operator allows iterables( arrays / objects / strings ) to be expanded into single arguments/...
This lifecycle method is invoked after an error has been thrown by a descendant component. It receives the error that was thrown as a parameter and should return a value ...
There are five kinds of generators, 1. **Generator function declaration:** ```javascript function* myGenFunc() { yield 1; yield 2; yield 3; } const genObj = myGenFunc(); ...
An update can be caused by changes to props or state. The below methods are called in the following order when a component is being re-rendered. 1. static getDerivedState...
HireXTech uses essential storage to remember your study preferences and third-party advertising cookies via Google AdSense in compliance with GDPR. You can choose to enable essential cookies only or accept all cookies. Read our Privacy Policy.