-
-
Save ACbosong/3613d8b350e1d8ed2e138ad1b887658c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 這個示例來自You Don't Know JS: https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/apA.md#var-and-let | |
function getStudents(data) { | |
var studentRecords = []; | |
for (let record of data.records) { | |
let id = `student-${ record.id }`; | |
studentRecords.push({ | |
id, | |
record.name | |
}); | |
} | |
return studentRecords; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment