Created
September 14, 2018 15:17
-
-
Save bicccio/b24d3c6c23401acf09df2c514abdbf99 to your computer and use it in GitHub Desktop.
JS Bin [add your bin description] // source https://jsbin.com/pemazok
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function Person(name){ | |
this.name = name; | |
this.sayYourName = function(){ | |
console.log(this.name) | |
} | |
} | |
Person.prototype.sayYourName = function(){ | |
console.log(this.name) | |
} | |
function Woman(name) { | |
Person.call(this, name); | |
this.haveBoobs = function(){ | |
console.log("yes") | |
} | |
} | |
Woman.prototype = Object.create(Person.prototype) | |
Woman.prototype.constructor = Woman; | |
var carla = new Woman("carla"); | |
console.log(Object.getPrototypeOf(Woman.prototype) === Person.prototype) | |
console.log(carla.__proto__ === Woman.prototype) | |
carla.sayYourName(); | |
carla.haveBoobs(); | |
console.log(carla.name) | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function Person(name){ | |
this.name = name; | |
this.sayYourName = function(){ | |
console.log(this.name) | |
} | |
} | |
Person.prototype.sayYourName = function(){ | |
console.log(this.name) | |
} | |
function Woman(name) { | |
Person.call(this, name); | |
this.haveBoobs = function(){ | |
console.log("yes") | |
} | |
} | |
Woman.prototype = Object.create(Person.prototype) | |
Woman.prototype.constructor = Woman; | |
var carla = new Woman("carla"); | |
console.log(Object.getPrototypeOf(Woman.prototype) === Person.prototype) | |
console.log(carla.__proto__ === Woman.prototype) | |
carla.sayYourName(); | |
carla.haveBoobs(); | |
console.log(carla.name)</script></body> | |
</html> |
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
function Person(name){ | |
this.name = name; | |
this.sayYourName = function(){ | |
console.log(this.name) | |
} | |
} | |
Person.prototype.sayYourName = function(){ | |
console.log(this.name) | |
} | |
function Woman(name) { | |
Person.call(this, name); | |
this.haveBoobs = function(){ | |
console.log("yes") | |
} | |
} | |
Woman.prototype = Object.create(Person.prototype) | |
Woman.prototype.constructor = Woman; | |
var carla = new Woman("carla"); | |
console.log(Object.getPrototypeOf(Woman.prototype) === Person.prototype) | |
console.log(carla.__proto__ === Woman.prototype) | |
carla.sayYourName(); | |
carla.haveBoobs(); | |
console.log(carla.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment