Hi I am trying to learn the difference, or what is happening between .prototype and just a regular instance. Can anyone explain it, and why isnt this code working? I get a type error: "undefined is not a function". I am just trying to see what happens between the Ninja() class and .prototype, and the first instance. Then I'm trying to see what happens when I make a new Ninja() class called ninja. And repeat
function Ninja() {
this.swingSword = function() {
return true;
};
}
Ninja.prototype.swingSword = function() {
return false;
};
var ninja = new Ninja;
console.log(Ninja.prototype.swingSword());
console.log(Ninja.swingSword());
console.log(ninja.swingSword());
console.log(ninja.prototype.swingSword());