The following code produces an error
let promesa = new promise(Function(resolve, reject) {
setTimeout(Function) {
resolve('timeout');
}, 1000);
};
promesa.then(function(data) {
console.log(data);
});
The console reports that there is a missing parenthesis , but I can not figure out what it is . I also want to add the try-catch pair with err.message, where do I put that code?
The error is that you did not put the last parenthesis of the promise and that is why it marks a syntax error, in addition to the fact that you wrote the instruction wrong, this is how the code should look
You have some errors in this code. Compare with this other one that works.
You use promise and it is Promise.
You use Function in callbacks, it's function. In the second you put Function), there is one missing (function() remains. Finally you need to close the new Promise, you have }; and it is });
;