且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将从诺言返回的值分配给全局变量

更新时间:2023-02-11 22:17:11

因为 console.log('Variable outside the promise: ' + HeapSizeLimit);HeapSizeLimit = memoryValues.jsHeapSizeLimit;之前执行.如果在约定之后就行了,那并不意味着执行顺序是相同的.

Because console.log('Variable outside the promise: ' + HeapSizeLimit); is executed before HeapSizeLimit = memoryValues.jsHeapSizeLimit;. If it's on the line after the promise, doesn't mean the execute order is the same.