摘要: ES6之前,定义一个函数(构造器)对象,使用this定义属性 使用new & 构造器创建一个新对象 function B(x){ console.log('B class') console.log(this); this.x=x; this.show=function(){console.log( 阅读全文
posted @ 2020-12-20 23:04 ascertain 阅读(118) 评论(0) 推荐(0) 编辑
摘要: loop const add=function (x,y){ return x+y; } const sub=function _sub(x,y){ return x-y; } console.log(add(5,7)) console.log(sub(5,8.3)) const sum=funct 阅读全文
posted @ 2020-12-20 19:05 ascertain 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 解构 var parts = ['shoulder', 'knees'] var lyrics = ['a', ...parts, 'b', 'c'] // 使用... 解构 console.log(lyrics) function f(x, y, z) { console.log(x + y + 阅读全文
posted @ 2020-12-20 13:03 ascertain 阅读(125) 评论(0) 推荐(0) 编辑
摘要: let b='designate' console.log(b.charAt(2)) console.log(b[2]) console.log(b.toUpperCase()) console.log(b.concat('.com')) console.log(b.slice(3)) consol 阅读全文
posted @ 2020-12-20 11:04 ascertain 阅读(126) 评论(0) 推荐(0) 编辑