Last active
June 15, 2018 22:18
-
-
Save mattbontrager/909ad90242a3007342cd1fef5e131bc3 to your computer and use it in GitHub Desktop.
Find the words in common between two strings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.same = function(str2) { | |
const arr1 = this.split(/\W/); | |
const arr2 = str2.split(/\W/); | |
return arr1.inCommon(arr2).join(' '); | |
}; | |
// requires use of this | |
// https://gist.github.com/mattbontrager/2a9b71c7110ab61f9ef948208646c85f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment