JS 闭包与作用域
函数自执行 Document .box{ width: 100px; height: 100px; background: red; } .box2{ width: 100px; height: 100px; background: yellow; } var box = document.querySelector(...
标签文章 2 篇
函数自执行 Document .box{ width: 100px; height: 100px; background: red; } .box2{ width: 100px; height: 100px; background: yellow; } var box = document.querySelector(...
return语句在函数定义中的作用有两个:一是返回函数值,二是中止函数的执行。 return可以返回包括基本数据类型、对象、函数等任意类型的值。 function fn(){ console.log(123) // 每一个函数 都有一个return // 默认return 的值是undefined // 后面如果有值,...