can someone make me understand why i get undefined in my output in the last line?
var protoRabbit = {
speak: function(line){
print_line(this.type+' says, '+this.line);
print_line(this.type+' says, '+line);
},
kill : function (){
console.log('killerRabbit is not killing');
}
};
var killerRabbit = Object.create(protoRabbit);
killerRabbit.type='killer';
killerRabbit.line='killer here';
killerRabbit.speak('killer rabbit here');
print_line(killerRabbit.kill());
op as on console:
killer says, killer here
killer says, killer rabbit here
killerRabbit is not killing
undefined
why is undefined there when i added a property(kill function to the initial object) ?
P.S.
print_line
is a custom function i made which takes an argument and prints output to console...