<meta name="viewport" content="width=device-width">
<script id="jsbin-javascript">
function Hero(name, level){
Hero.prototype.greet = function(){
function Warrior(name,level,weapon){
Hero.call(this, name, level);
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');
<script id="jsbin-source-javascript" type="text/javascript">function Hero(name, level){
Hero.prototype.greet = function(){
function Warrior(name,level,weapon){
Hero.call(this, name, level);
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.attack();</script></body>