摘要: //match() var str = "中国移动10086,中国联通10010,中国电信10000"; let arr = str.match(/\d{5}/g)//10086 10010 10000 //replace() let str="盈十里煌绸 交 错" str.replace(/\s/ 阅读全文
posted @ 2021-10-23 23:35 yongerbingxuan 阅读(21) 评论(0) 推荐(0)
摘要: function num(){ var num=10; num++; console.log(num); } num();//11 num();//11 num();//11 function f1(){ var num=10; return function(){ num++; return nu 阅读全文
posted @ 2021-10-23 22:42 yongerbingxuan 阅读(30) 评论(0) 推荐(0)
摘要: //call继承主要是继承构造函数中的属性 function Person(age, sex) { this.age = age; this.sex = sex; } Person.prototype.Sleep = function () { console.log("睡觉"); } Person 阅读全文
posted @ 2021-10-23 19:12 yongerbingxuan 阅读(108) 评论(0) 推荐(0)
摘要: //原型继承主要是继承构造函数中的原型(改变原型指向) 在子类构造函数与父类构造函数中有相同的属性时父类无法覆盖子类 function Person(age,sex){ this.age=age; this.sex=sex; } Person.prototype.Sleep=function(){ 阅读全文
posted @ 2021-10-23 19:03 yongerbingxuan 阅读(37) 评论(0) 推荐(0)