Ad
  • Custom User Avatar

    No, you shouldn't return anything. The fact that the Node obects are reference types by virtue of being class instances has no bearing on the fact that you can't expect to simply assign to them within your function, as this simply changes the object the local variables front and back refer to.
    You need to make front have the value of the front of the list and also point towards the second, etc.

  • Custom User Avatar

    throw 'whatever' works. throw new Error() works, but your current code only does this... Please read the description.

  • Custom User Avatar

    Indeed, the problem is you renamed the properties, look at the initial code:

    function Ship(draft,crew) {
     this.draft = draft;
     this.crew = crew;
    }
    

    Now it doesn't matter anyway, try again.

  • Custom User Avatar

    Which language? What's your code?