D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
aaditya-007
Full window
Github gist
// source https://jsbin.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>JS Bin</title> </head> <body> <script id="jsbin-javascript"> function Hero(name, level){ this.name = name; this.level = level; } Hero.prototype.greet = function(){ console.log(this.name); } function Warrior(name,level,weapon){ Hero.call(this, name, level); this.weapon = weapon; } Warrior.prototype = Object.create(Hero.prototype); Hero.prototype.attack = function(){ console.log(this.name + ' with ' + this.weapon); } console.log(Warrior.prototype); var batman = new Warrior('sam','me','trishool'); batman.greet(); batman.attack(); </script> <script id="jsbin-source-javascript" type="text/javascript">function Hero(name, level){ this.name = name; this.level = level; } Hero.prototype.greet = function(){ console.log(this.name); } function Warrior(name,level,weapon){ Hero.call(this, name, level); this.weapon = weapon; } Warrior.prototype = Object.create(Hero.prototype); Hero.prototype.attack = function(){ console.log(this.name + ' with ' + this.weapon); } console.log(Warrior.prototype); var batman = new Warrior('sam','me','trishool'); batman.greet(); batman.attack();</script></body> </html>