I tried running the following code on Chrome and got an unexpected result.
<script>
let p = new Promise((resolve, reject) => {
setTimeout(() => {
resolve('OK');
}, 1000)
})
console.log(p);
</script>
The Promise Object printed on Chrome console was enter image description here. (state='fulfilled', result='OK)
But the Promise Object printed on VScode console was enter image description here. (state='pending', result=undefined)
From what I learned about JS event loop, since setTimeout() is asynchronous, the code 'resolve('OK')' will not be executed untill the synchronous codes were done.
So I think the VScode result is what I should expect right? But what caused the different results between Chrome and VScode? Thank you ^ ^
