Skip to content

Instantly share code, notes, and snippets.

@bicccio
Created September 14, 2018 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bicccio/b24d3c6c23401acf09df2c514abdbf99 to your computer and use it in GitHub Desktop.
Save bicccio/b24d3c6c23401acf09df2c514abdbf99 to your computer and use it in GitHub Desktop.
JS Bin [add your bin description] // source https://jsbin.com/pemazok
<!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>
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