当前位置: 首页 > news >正文

西安外贸网站建设公司做游戏CG分享的网站

西安外贸网站建设公司,做游戏CG分享的网站,网页制作视频教程下载,凉山州城乡规划建设局网站变量声命周期 垃圾回收 找出不再使用的变量释放其占用内存固定的时间间隔运行 解除由于闭包产生的对fn AO的引用 标记清除 排除全局变量、排除闭包引用的AO中的变量进入环境 → 离开环境常用 引用计数 引用计数为0时清除对循环引用的情况#xff0c;如果不手动接触引用…变量声命周期 垃圾回收 找出不再使用的变量释放其占用内存固定的时间间隔运行 解除由于闭包产生的对fn AO的引用 标记清除 排除全局变量、排除闭包引用的AO中的变量进入环境 → 离开环境常用 引用计数 引用计数为0时清除对循环引用的情况如果不手动接触引用(a null)则无法清除 arguments 属性 函数内部对应参数值的实参列表类数组对象 Array-like有属性callee指向它的宿主函数属性Symbol(Symbol.iterator) 表示可迭代constructor是Object有length属性属性下标从0开始没有数组的内置方法注意箭头函数没有arguments function test(a, b) {console.log(arguments) // 1 2 3console.log(Object.prototype.toString.call(arguments)) // [object Arguments]console.log(Array.isArray(arguments)) // false } test(1, 2, 3,) 普通对象是不可迭代的 三个参数迭代到第四个便完成了 function* generator(args) {for (var key in args) {yield key} } var it generator(obj) console.log(it.next()) console.log(it.next()) console.log(it.next()) console.log(it.next()) function test(a, b) {var it generator(arguments)console.log(it.next())console.log(it.next())console.log(it.next())console.log(it.next()) } test(1, 2, 3)箭头函数内使用实参(es6弱化了arguments) 严格模式让arguments和eval少了一些奇怪的行为。两者在通常的代码中都包含了很多奇怪的行为。 Strict mode makes arguments and eval less bizarrely magical. Both involve a considerable amount of magical behavior in normal code. arguments的一些操作会阻止js引擎的优化 对参数使用slice会阻止某些JavaScript引擎中的优化 (比如 V8 - 更多信息)。如果你关心性能尝试通过遍历arguments对象来构造一个新的数组。另一种方法是使用被忽视的Array构造函数作为一个函数 var args (arguments.length 1 ? [arguments[0]] : Array.apply(null, arguments)); bluebird-petkaantonov 多种方式将arguments转为新数组返回 function test() {var arr []for (var v of arguments) {arr.push(v)}// return arr// return arguments.length 1 ? [arguments[0]] : Array.from(arguments)return arguments.length 1 ? [arguments[0]] : Array.apply(null, arguments) } console.log(test(1, 2, 3))使用场景 实参个数 形参个数不定参数 形、实参的对应关系 Note: If you’re writing ES6 compatible code, then rest parameters should be preferred. Note: “Array-like” means that arguments has a length property and properties indexed from zero, but it doesn’t have Array’s built-in methods like forEach() and map(). See §Description for details. 当非严格模式中的函数没有包含剩余参数、默认参数和解构赋值那么arguments对象中的值会跟踪参数的值反之亦然。 1. 形参中但凡有一个有默认值 形、实参不再对应 function test(a 100, b, c) {arguments[1] 1000console.log(b, arguments[1]) // 2 100 } test(1, 2, 3)不统一的具体表现 1. ES6形参默认值 当实参为undefined时形参若有默认值便取默认值 function test(a 100, b, c) {arguments[0] 1000console.log(a, arguments[0]) // 100 1000 } test()形参、实参并不统一 function test(a 100, b, c) {console.log(a, arguments[0]) // 100 undefined } test()修改形参便不再取默认值 function test(a 100, b, c) {a 666console.log(a, arguments[0]) // 666 1 } test(1)2. ES6使用展开运算符 function test(...args) {arguments[0] 100console.log(args[0], arguments[0]) // 1 100 } test(1)3. ES6参数解构 function test({ a, b, c }) {arguments[0][a] 100console.log(a, arguments[0][a]) // 1 100 } test({ a: 1, b: 2, c: 3 })MDN: 注意: 在严格模式下arguments对象已与过往不同。arguments[iterator]不再与函数的实际形参之间共享同时caller属性也被移除。 4*. 严格模式下怎么都不对应 function test(a, b, c) {use strictarguments[0] 100console.log(a, arguments[0]) // 1 100 } test(1)5. ES5实参undefined var test function (a, b) {a 1console.log(a, arguments[0]) // 1 undefined } test()// 这个相当于es5无默认值 var test function (a undefined, b) {console.log(a, arguments[0]) // 100 100 } test(100)arguments
http://www.pierceye.com/news/8419/

相关文章:

  • 网站建设的网络技术保洁公司用哪些网站做推广
  • 英文网站中英对照旅游门户网站模板
  • 深圳网站备案拍照点网站建设人员的安排
  • 四川网站建设找珊瑚云超市网站开发建设建议
  • 做网站编辑我能力得到提升做专利网站的重要点
  • 乐山市规划和建设局门户网站跨境电商关键词工具
  • 朝阳网站优化爱站网反链查询
  • 班级网站设计素材旅游网站开发内容
  • 学做蛋糕什么网站购物网站开发的必要性
  • 网站开发需要哪些铁岭免费移动网站建设
  • 做网站网站判刑wordpress小程序前端
  • 大连建设网站的公司wordpress自助建站
  • 区块链 做网站wordpress 关注公众号
  • 汕尾网站设计app网站制作
  • 佛山做推广网站的做网站建设的公司是什么类型
  • 濮阳公司建站招远做网站哪家好
  • 系统软件开发工程师江苏seo培训
  • 做相同性质的网站算侵权吗工厂办公室简单装修
  • 公司网站怎么做关键词携程旅行网
  • 网站开发哪家公司好公司名称logo设计
  • 营销型网站建设价格网站系统使用说明书
  • 成都网站的建设招聘网站策划书
  • 织梦网站变成手机站微信网站入口
  • 泊头哪里建网站呢网站如何做反爬
  • 网站总浏览量备案号查询平台
  • 自己怎么做网站卖东西快速搭建网站vue
  • 工作室网站域名黄骅招聘网最新招工信息
  • wordpress建站案例视频教程wordpress 修改数据库
  • 使用div建设的网站从化移动网站建设
  • 老板让做网站报价快递网站模版