Last active
August 29, 2015 14:02
-
-
Save 17/288312be28eefdb3e716 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cat = function (hands, feet) { | |
this.hands = hands | |
this.feet = feet | |
}, | |
fatcat = function (hands, feet, kg) { | |
this.kg = kg | |
console.log(this) | |
cat.call(this, hands, feet) | |
// 我在这里以**当前作用域**运行了 cat | |
// **相当于** 在这里运行了 | |
// +function (that, hands, feet) { | |
// that.hands = hands | |
// that.feet = feet | |
// }(this, hands, feet) | |
// 然后我就多了 this.hands 和 this.feet | |
// | |
return this | |
}, | |
mycat = new fatcat(0, 0, 50); | |
console.log(mycat) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment