1. async function testSometing() {
    2. console.log('执行testSomething') // 2
    3. return 'testSomething'
    4. }
    5. async function testAsync() {
    6. console.log('执行testAsync') // 6
    7. return Promise.resolve('hello async')
    8. }
    9. async function test() {
    10. console.log('test start...') // 1
    11. const v1 = await testSometing()
    12. console.log(v1) // 5
    13. const v2 = await testAsync()
    14. console.log(v2) // 8
    15. console.log(v1, v2) // 9
    16. }
    17. test()
    18. var promise = new Promise((resolve) => {
    19. console.log('promise start...') // 3
    20. resolve('promise')
    21. })
    22. promise.then((val) => console.log(val)) // 7
    23. console.log('test end...') // 4