问答题785/1530【Promise第35题】下面代码的输出是什么?

1async function testSometing() { 2 console.log("执行testSometing"); 3 return "testSometing"; 4} 5 6async function testAsync() { 7 console.log("执行testAsync"); 8 return Promise.resolve("hello async"); 9} 10 11async function test() { 12 console.log("test start..."); 13 const v1 = await testSometing(); 14 console.log(v1); 15 const v2 = await testAsync(); 16 console.log(v2); 17 console.log(v1, v2); 18} 19 20test(); 21 22var promise = new Promise(resolve => { 23 console.log("promise start..."); 24 resolve("promise"); 25}); 26promise.then(val => console.log(val)); 27 28console.log("test end..."); 29
难度:
2022-01-09 创建

赞赏支持

预览

题库维护不易,您的支持就是我们最大的动力!