Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Cluttering String.prototype with helper functions really isn't good practice either. No sense in cluttering the global scope either. Best practice would probably be to create a function within the scope of isAnagram, since it'll only be needed by it. Although, there's really nothing wrong with just repeating the string operation. It's not a complex enough operation to make outsourcing it absolutely necessary.

    I agree with you about the ternary operator, though. a == b ? true : false is probably one of the dumbest anti-patterns ever.