Ad
  • Custom User Avatar

    Instead of the defining in the prototype, the author of the kata is defining it in the constructor.

    This means that you would have to include this.process = process; in the constructor. This is generally bad practice as each instance would contain a duplicate of the process function instead of looking up the prototype chain for it.

  • Custom User Avatar

    I don't understand how the code template for JS is setup here. I'm more used to seeing prototype style like this. Can anyone shed some light?

    
    function Plugboard(wires){
      //your code here
    }
      Plugboard.prototype.process = function(wire){
        //your code here
    }
    
    plugboard = new Plugboard("AB");
    plugboard.process('A');