We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
简单说,for in是遍历键名,for of是遍历键值。例如: `let arr = ["a","b"]; for (a in arr) { console.log(a);//1,2 }
for (a of arr) { console.log(a);//a,b }` 由于for of的这个特性,他还可以实现对iterator对象的遍历,而for in就是简单的遍历了。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
简单说,for in是遍历键名,for of是遍历键值。例如:
`let arr = ["a","b"];
for (a in arr) {
console.log(a);//1,2
}
for (a of arr) {
console.log(a);//a,b
}`
由于for of的这个特性,他还可以实现对iterator对象的遍历,而for in就是简单的遍历了。
The text was updated successfully, but these errors were encountered: