这里罗列了《你不知道的js》上卷的一些知识点以及小问题,如果你想巩固一下js那么就和我一起来看看吧。
如果你能不看书就回答上80%的问题说明你js的这一部分学得还不错,再接再厉。
1 function foo() {  
2     function bar() {}; 
3      /*...*/
4 }
 1 function A(name) {
 2 this.name = name;
 3 }
 4 A.prototype.sayName = function() {
 5 console.log(this.name);
 6 };
 7 function B(name) {
 8 A.call(this, name);
 9 }
10 B.prototype = Object.create(A.prototype);
11 var b = new B(‘Nic‘);
12 b.sayName(); //Nic
1 var A = {
2 init: function(name) { this.name = name; },
3 sayName: function() { console.log(this.name); }
4 };
5 var B = Object.create(A);
6 B.init(‘Nic‘);
7 B.sayName() //Nic
 1 class A {
 2 constructor(name, age) {
 3 this.name = name;
 4 this.age = age;
 5 }
 6 sayName() {
 7 console.log(‘hello, my name is: ‘+this.name);
 8 }
 9 }
10 var a = new A(‘wind‘, 20);
11 a.sayName(); //hello, my name is: wind
(以上答案三天后公布)
原文:http://www.cnblogs.com/wind-lanyan/p/6552835.html