Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function subStringBetweenTwo(a, b) {
- const arr = a.split('');
- const brr = b.split('');
- return [...new Set(arr.filter(item => brr.indexOf(item) !== -1))]
- }
- subStringBetweenTwo('Hello', 'World')
- // output: ['l', 'o']
- subStringBetweenTwo('Hi', 'World')
- // output: []
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement