我想在source arry和sort arry之间添加"After sort:",如下所示:

但控制台偶尔会显示:

为什么for-of-loop还没有运行完毕,跳出来运行console.log?源代码:
// Random to generate double digits.
function getRandom() {
return Math.round(Math.random() * 100);
}
// Writing data to the array.
var score = [
["a", getRandom()],
["b", getRandom()],
["c", getRandom()],
["d", getRandom()],
["e", getRandom()]
];
console.log("Before sort:");
// Print source arry
for (let m of score) {
console.log(m);
}
// Call sort()
score.sort((a, b) => {
return b[1] - a[1];
});
console.log("After sort:");
// …Run Code Online (Sandbox Code Playgroud) javascript node.js node-inspector console.log visual-studio-code