A promise is an object used as a placeholder for a value, which might be available as a result of asynchronous operations such as a response from an HTTP request.
When we make an asynchronous call, it immediately returns a promise object to register callbacks that will run when the…
Let's first discuss how variables declared, with
let are different.
var are used to declare variables, that can be optionally initialized at the time of declaration.
As per MDN:
varstatement declares a function-scoped or globally-scoped variable, optionally initializing it to a value.