Skip to content

Instantly share code, notes, and snippets.

@mattbontrager
Last active June 15, 2018 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattbontrager/fe8381ac3130c35f1c69fe968177d37e to your computer and use it in GitHub Desktop.
Save mattbontrager/fe8381ac3130c35f1c69fe968177d37e to your computer and use it in GitHub Desktop.
Find different words between to strings.
String.prototype.different = function(str2) {
const arr1 = this.split(/\W/);
const arr2 = str2.split(/\W/);
return arr1.diff(arr2).join(' ');
};
// requires this as well
// https://gist.github.com/mattbontrager/7500cc5696ff4efe249f2ac0adbeb8ec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment