You are viewing a single comment's thread from:

RE: JavaScript开发笔记

in #starnoteyesterday

函数是一段可以反复调用的代码块。函数还能接受输入的参数,不同的参数会返回不同的值。

function print(s) {
  console.log(s)
}


//动态参数
function print(...s) {
  for(let i of s){
    console.log(i)
  }
}