Ad
  • Custom User Avatar

    Along with what Jhonny said, i'd like to add that it's not good practice to write/modify the prototype property of an built-in objects.

  • Custom User Avatar

    I don't think you should use \b in regular expression to get the words as it will fail for any words that contain non-latin characters. According to the definition of \b "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions" Note: JavaScript's regular expression engine defines a specific set of characters to be "word" characters. Any character not in that set is considered a word break. This set of characters is fairly limited: it consists solely of the Roman alphabet in both upper- and lower-case, decimal digits, and the underscore character. Accented characters, such as "é" or "ü" are, unfortunately, treated as word breaks.