console 命令行工具
X
clear
> function Object() { [native code] }
> function Ninja() {
this.swung = true;
}
console
function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype.say = function() {
console.log('我叫' + this.name);
}
function Coder(name, age, job) {
Person.call(this, name, age);
this.job = job;
}
Coder.prototype.say = Person.prototype.say;
Coder.prototype.say = function() {
console.log(1);
}
var p1 = new Person('kaivon');
var c1 = new Coder('kaivon', 18, '前端');
function Ninja() {
this.swung = true;
}
const ninja1 = new Ninja();
Ninja.prototype.swingSword = function() {
return this.swung;
};
Ninja.prototype = {
pierce: function() {
return true;
}
}
const ninja2 = new Ninja();
console.log(ninja2.constructor);
console.log(ninja1.constructor);
<label for="">
</label>