Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
console.clear();
function Person() {  
}
// Construct new object 
var p = new Person();
// true
console.log(p.__proto__ === Person.prototype);
// true
console.log(Person.prototype.__proto__ === Object.prototype);
var o = {};
// true
console.log(o.__proto__ === Object.prototype);
function Girl() {  
}
Girl.prototype = Object.create(Person.prototype);
// true
console.log(Girl.prototype.__proto__ === Person.prototype);
console.log(Person.constructor);
// true
console.log(Girl.constructor === Function);
// Best practices say reset the constructor to be itself
Girl.constructor = Girl;
// points to Girl function
console.log(Girl.constructor);
function SillyGirl() {  
}
SillyGirl.prototype = Object.create(Girl.prototype);
console.log(SillyGirl.constructor);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
MikeCheelpro
0viewers