-
Notifications
You must be signed in to change notification settings - Fork 38.2k
Closed
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugdebugDebug viewlet, configurations, breakpoints, adapter issuesDebug viewlet, configurations, breakpoints, adapter issuesverifiedVerification succeededVerification succeeded
Milestone
Description
Runtime environment
- Visual Studio Code v1.15.1 own compiler
- Node.js v8.2.1
- OS: Windows_NT ia32 10.0.15063
Description
I want to add "After sort:" between source arry and sort arry, look like this:
But console occasionally shows:
Why for-of-loop has not finished running, jump out to run console.log ? Source code:
// 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:");
// Print sort arry.
for (let n of score) {
console.log(n);
}If i change my code like this:
// Writing data to the array.
var score = [["a", 55], ["b", 33], ["c", 44], ["d", 88], ["e", 22]];
// Print source arry
for (let m of score) {
console.log(m);
}
console.log("After sort:");Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugdebugDebug viewlet, configurations, breakpoints, adapter issuesDebug viewlet, configurations, breakpoints, adapter issuesverifiedVerification succeededVerification succeeded


