What will be the output of the following code?
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('Something went wrong!'));
}, 2000);
});
promise.catch((error) => {
console.log(error.message);
});
What will be the output of the following code?
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('Something went wrong!'));
}, 2000);
});
promise.catch((error) => {
console.log(error.message);
});