0

i got error

var prom = function () { return new Promise((resolve, reject) => { setTimeout(() => { resolve("29383") reject("86565") }, 1000); }) } Promise.all([prom()]).then((result)=>{return result[0]}).then((Number(result1))=>{ console.log(result1+23) })

13th Sep 2021, 1:57 PM
Aniket Ganguly
2 Réponses
+ 1
It isn't able to convert result1 to Number . Maybe because it is just a parameter and you can't operate on it that way !! Convert result1 to number inside function. You can use +result1 to convert to int as well.
13th Sep 2021, 2:13 PM
Abhay
Abhay - avatar
0
Missing parenthesis after the closing of setTimeout
13th Sep 2021, 3:15 PM
Kamil Hamid
Kamil Hamid - avatar