February 2022

JavaScript: Split string and keep the separators

JavaScript: Split string and keep the separators

  • February 1, 2022

String.prototype.split() is a valuable method to split strings based on a delimiter. There often comes a scenario when we want to split a string and keep the separators in the result. The same JavaScript method provides a way to do so. Before we get into that, for people who are...