ES6
fjdkk
这个作者很懒,什么都没留下…
展开
-
ES箭头函数
箭头函数 认识箭头函数 箭头函数结构:const/let 函数名 = (参数)=> { 函数体 } 将普通函数改写为箭头函数 const add=function(x,y){}; const add=(x,y)=>{}; 注意事项 单个参数:可以省略圆括号,无参或多个参数不能省略:const add = x =>{} 单行函数体:可以同时省略{}和return,多行函数体不能再简化:const add = (x,y)=>x+y 单行对象:返回单行对象,原创 2021-11-09 13:23:33 · 1720 阅读 · 0 评论 -
ES--模板字符串
模板字符串 认识模板字符串 用反引号包裹 和其他东西一起使用时,使用模板字符串方便注入 const person = { username: 'Alex', age: 18, sex: 'male' }; // 一般字符串 const info='名字'+person.username+'年龄'+person.age; //模板字符串 const info_mb=`名字${person.username} 年龄${person.age}`; console.log(info); cons原创 2021-11-09 12:50:34 · 2074 阅读 · 0 评论