Question from the Node.js test

Write a NodeJS code that will display 'Catch error'.

Medium

What will be the result of the following code?

let promise = new Promise(function(resolve, reject) {
  resolve("ok");
});

promise
  .then(function(result) { throw new Error("error"); })
  .catch(function(error) { console.log("Catch", error.message); });
Author: AxelStatus: PublishedQuestion passed 58 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!