What would the output of the following code snippet? [Promises in JavaScript]
@Yomesh Gupta
What would be the output of the following code snippet if we run this as it is?
function processing() {
return Promise.reject("Something went wrong!");
}
function init() {
try {
return processing();
} catch (err) {
console.log("Error in processing.");
}
}
init().then(() => {
console.log("End");
});
Option 1
Error in processing
Option 2
End
Option 3
Uncaught (in promise) Error in processing.
Option 4
Uncaught (in promise) Something went wrong!
Option 5
Error in processing. End
Option 6
Something went wrong! End