I have my code where I capture the text, the idea is to count how many times the word BANANA is written in that text independently, whether I write it in order or out of order knowing that the word BANANA has 1 B, 3 A and 2 N.
For example, if I write NAABXXAN it will return 1 because the word BANANA is in the string once and out of order, and if I write NAANAAXNABABYNNBZ it will return 2 because the word BANANA is in the string twice and also out of order.
let vocalA=["A"];
function contarArray(str){
let contarVocal= 0;
for (let i of str.toUpperCase() ){
if (vocalA.includes(i)){
contarVocal++;
}
}
console.log("letras A");
//console.log("letA" + contarVocal);
return contarVocal
}
contarArray('BASCO')