I have a ES7 code like this.
async function returnsfive() {
var three = 3;
var threeP = await three;
return threeP+2;
}
returnsfive().then(k=>console.log(k), e=>console.error("err", e))
What should happen at the var threeP = await three
line?
Should the code continue as expected, or fail, because three
is not a promise?
In this repo, it is mentioned as "Debatable Syntax & Semantics". I am not able to read through the official documentation to find the exact definition, since it's too technical.
Default babel.js transformation logs 5 as expected; however, nodent
- a different transform - prints TypeError: three.then is not a function
. Which is correct and why?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…