function Ninja() { this.swung = false this.swingSword = function() { return !this.swung } } function assert(value,text) { if(value === true) { console.log(text) } else { console.log('error') } } Ninja.prototype.swingSword = function() { return this.swung } const ninja = new Ninja() ninja.swingSword = function() { return '123' } assert(ninja.swingSword() === '123','called the instance method,not the prototype method')