I have an array of words, for example -
const array = ["apple", "apricot", "avocado"];
I want to look for the words that contain
- All the letters from the array
- to be in order. If I'm writing -
const L = ["a", "o", "c"];
const out = arrayF.filter ((el) => L.every ((letter) => el.includes (letter)));
Although he is looking for me all the letters, but if for example I will write-
const L = ["a", "a", "a"];
- This's causing me some problems.
Even if I searched 3 times for the letter a he will also find me the one who has only once the letter.
When I search according to -
const L = ["a", "o", "c"];
He also finds me "apricot" even if the "o" after the "c"
Regards