lybcyd
2021-11-30 22:46:25 +08:00
JS 分号可以不写,你自己处理好特殊情况就可以
Python:
names = ["name1", "name2", "name3", "name4", "name5"]
def loopSelected():
for name in names:
print(name)
JS:
let names = ["name1", "name2", "name3", "name4", "name5"]
function loopSelected() {
for (let name of names) {
console.log(name);
}
}
或者
let names = ["name1", "name2", "name3", "name4", "name5"]
function loopSelected() {
names.forEach(name => {
console.log(name)
});
}
并没有麻烦到哪里去