COMMON ERROR IN JS TypeError: Cannot read property ‘length’ This kind of error occurs when we are reading length property for an undefined variable. FIX To fix this we need to check whether the data type assigned to that variable have the length property Uncaught TypeError: Cannot set property This kind of error occur when we are trying to set a property for some data type which doesn’t have Property .For Example data type undefined doesn’t have any property FIX To fix this we need to check whether the data type assigned to that variable have any property or not Uncaught TypeError: Cannot read property This kind of error occur when we are trying to access the defined variables/function/data FIX To fix this we need to check whether the data has some value and it not equal to undefined TypeError: ‘undefined’ is not an ...
CORS 1. CORS is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own. 2. An example of a cross-origin request: the front-end JavaScript code served from https://domain-a.com uses XMLHttpRequest to make a request for https://domain-b.com/data.json. 3. For security reasons, browsers restrict cross-origin HTTP requests initiated from scripts. For example, XMLHttpRequest and the Fetch API follow the same-origin policy. This means that a web application using those APIs can only request resources from the same origin the application was loaded from unless the response from other origins includes the right CORS headers. 4. The CORS mechanism supports secure cross-origin requests and data transfers between bro...