I was trying to come up with a simple example to show how promises get around a blocking call, but this example isn't working the way I expect
function blockForLoopPromise() {
return new Promise((resolve, reject) => {
for (let i = 0 ; i < 10000000000 ; i++) {
}
resolve("done")
})
}
blockForLoopPromise().then(() => console.log("DONE!"))
console.log("END")
In this example, "END" is not called until the long for loop is completed. Shouldn't it be called immediately?