Ad
  • Custom User Avatar

    I'll readily admit that this is a terrible submission, it's been a long tiring week so mental energy is at a very low ebb. And this only passed assessment with multiple attempts. So that makes this both unreliable and ugly. But at least it enabled me to see the far more elegant solutions already submitted :-)

  • Custom User Avatar
  • Custom User Avatar

    Can someone please explain how this answer is 'better' per say than other solutions here, for example Arhigod's solution. While it's functional it is verbose, uses a plethora of unnecessary variables, has a console.log still stuck in it and as a result still has lots of room for refactoring. Genuinely wondering?