这个课应该是js的进阶课程,看了这个老师的课程,恍然发现,原来js还有这么多知识呢。里面的很多题目,如果作为面试题,我相信会难倒一大片前端开发者。。。。看了老师的讲解,确实深入浅出,不过不知道实际开发中怎么运用啊,比如js对象的创建,属性的添加,我只用最简单的那种,干嘛搞那么复杂啊???
2018-04-30
. 除\n以外的任何字符;
\d 数字;
\D 非\d;
\w 数字字母或_;
\W 非\w;
\s 空格;
\S 非\s;
\n\t\v\f\b\r 转义字符;
[] 范围;
[^] 范围以外;
^ 行首;
$ 行位;
\ 转义;
* 0或多次;
+ 1或多次;
? 0或1次;
\d 数字;
\D 非\d;
\w 数字字母或_;
\W 非\w;
\s 空格;
\S 非\s;
\n\t\v\f\b\r 转义字符;
[] 范围;
[^] 范围以外;
^ 行首;
$ 行位;
\ 转义;
* 0或多次;
+ 1或多次;
? 0或1次;
2018-04-27
模块化(封装)的三种形式:
1,var o;
o = function(){
var p1;
var f1 = function(){};
return { prop: p1, func: f1 };
}();
2, var o;
(function(){
o.prop = p1;
o.func = function(){};
})();
3, var o;
o = new function(){
this.prop = p1;
this.func = function(){};
}();
1,var o;
o = function(){
var p1;
var f1 = function(){};
return { prop: p1, func: f1 };
}();
2, var o;
(function(){
o.prop = p1;
o.func = function(){};
})();
3, var o;
o = new function(){
this.prop = p1;
this.func = function(){};
}();
2018-04-27
function Father(){ }
Father.fn = function(){ }
function Sun(){
Father.call(this);
}
Sun.prototype = Object.create(Father.prototype);
Sun.prototype.constructor = Sun;
Sun.prototype.fn = function(){
Father.prototype.fn.apply(this);
}
Father.fn = function(){ }
function Sun(){
Father.call(this);
}
Sun.prototype = Object.create(Father.prototype);
Sun.prototype.constructor = Sun;
Sun.prototype.fn = function(){
Father.prototype.fn.apply(this);
}
2018-04-27
if(!Objecreate)
Object.create = function(proto){
var o = {};
o.prototype = proto;
return o;
}
Object.create = function(proto){
var o = {};
o.prototype = proto;
return o;
}
2018-04-27
if(!Object.create){
Object.create = function(proto){
function F(){}
F.prototype = proto;
return new F();
}
}
Object.create = function(proto){
function F(){}
F.prototype = proto;
return new F();
}
}
2018-04-27
1, p in o; //实例和原型链上的所有属性
2, for(var p in o); //实例和原型链上的所有可枚举的属性
3, o.hasOwnProperty(p); //仅实例属性,不包括原型链上的属性
2, for(var p in o); //实例和原型链上的所有可枚举的属性
3, o.hasOwnProperty(p); //仅实例属性,不包括原型链上的属性
2018-04-27
var o = {x: 1, y: 2};
Object.prototype.z1 = 'zhao';
Object.defineProperty(Object.prototype, 'z2', { writable: true, value: 'qian' });
for(var p in o){ console.log(p, ': ', o[p]); }
//x: zhao y: qian z: sun
Object.prototype.z1 = 'zhao';
Object.defineProperty(Object.prototype, 'z2', { writable: true, value: 'qian' });
for(var p in o){ console.log(p, ': ', o[p]); }
//x: zhao y: qian z: sun
2018-04-27