I want to check if all of the audio file names in unorderedPhrases array exist in the result array that contains the URLs. if there are all exist return true and if-else return false.
Here is what I've tried. I don't know why it returns false all the times!?
let result = [
"https://example.com/test/unordered/i was sent to earth to protect you_A/i was sent.mp3",
"https://example.com/test/unordered/i was sent to earth to protect you_A/to earth.mp3",
"https://example.com/test/unordered/i was sent to earth to protect you_A/to protect you.mp3",
];
const unorderedPhrases = [
'i was sent',
'to earth',
'to protect you'
];
function checkResults(){
return unorderedPhrases.every(r=> result.includes(r));
}
console.log(checkResults())
The above code should return true because all the audio files in unorderedPhrases exist in the result array.
if we have this array then it should return false because there is a item in unorderedPhrases that doesn't exist in result :
let result = [
"https://example.com/test/unordered/i was sent to earth to protect you_A/i was sent.mp3",
"https://example.com/test/unordered/i was sent to earth to protect you_A/to earth.mp3",
];