Last active
June 11, 2019 04:43
-
-
Save gravitano/3bbe6e86a4cbab004cffc74af3c8221f to your computer and use it in GitHub Desktop.
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
function subStringBetweenTwo(a, b) { | |
const arr = a.split(''); | |
const brr = b.split(''); | |
return [...new Set(arr.filter(item => brr.includes(item)))] | |
} | |
subStringBetweenTwo('Hello', 'World') | |
// output: ['l', 'o'] | |
subStringBetweenTwo('Hi', 'World') | |
// output: [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment