摘要: 传统的导入导出 const sum=function (a,b){ return a+b; } module.exports={ sum } const m=require('./httpserver') console.log(m.sum(1,2)) es6 export function sum 阅读全文
posted @ 2021-09-01 19:56 老运维 阅读(20) 评论(0) 推荐(0)
摘要: //烟花特效 class Circle { constructor({origin, speed, color, angle, context}) { this.origin = origin this.position = {...this.origin} this.color = color t 阅读全文
posted @ 2021-09-01 18:23 老运维 阅读(183) 评论(0) 推荐(0)
摘要: 自带的循环,并且会把处理的值回填对应的位置 let arr=[1,2,3,4,5,6] let newarr=[]; for(let i=0;i<arr.length;i++){ newarr.push(arr[i]*2); } let newarr2=arr.map(function (ele){ 阅读全文
posted @ 2021-09-01 11:30 老运维 阅读(22) 评论(0) 推荐(0)
摘要: let info={ title:"0", link:"1" ,go:function (){ console.log("2"); } } var {name,address,...person2}=info; 阅读全文
posted @ 2021-09-01 11:28 老运维 阅读(34) 评论(0) 推荐(0)
摘要: 传统 let info={ title:"0", link:"1" ,go:function (){ console.log("2"); } } / 通过点获取 console.log(info.title); // 通过[]获取 console.log(info["title"]) es6 相当于 阅读全文
posted @ 2021-09-01 10:35 老运维 阅读(136) 评论(0) 推荐(0)
摘要: 1如果key和变量的名字一致,可以指定义一次即可 2如果value是一个函数,可以把:funtion去掉 只剩()即可 let info={ title:"0", link:"1" ,go:function (){ console.log("2"); } } var title="0"; var l 阅读全文
posted @ 2021-09-01 09:58 老运维 阅读(54) 评论(0) 推荐(0)