-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (31 loc) · 833 Bytes
/
app.js
File metadata and controls
31 lines (31 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var Human = (function () {
function Human(name) {
this.name = name;
}
Human.prototype.eat = function () {
console.log(this.name + " is a Human and is eating");
};
return Human;
})();
var Robot = (function () {
function Robot(name) {
this.name = name;
}
return Robot;
})();
var Animal = (function () {
function Animal(name) {
this.name = name;
}
Animal.prototype.eat = function () {
console.log(this.name + " is a Human and is eating");
};
return Animal;
})();
var r = new Robot("R2-D2");
var r0 = new Animal("Donkey"); //how is this possible?
var isItRobot = r0 instanceof Robot;
console.log("Is Donkey a Robot: " + isItRobot); //false, giving the right results
var h = new Human("Tom");
console.log(h.eat());
//# sourceMappingURL=app.js.map