I have two string and want to check if one includes the other. Any ideas how to compare them properly?
let str1 = 'love you too much';
let str2 = 'lo ou to uc';
if (str1.includes(str2)) {
console.log('str1 includes str2');
} else {
console.log('str1 does not include str2');
};
When I use the includes method I get the result 'False'.
str1does not includestr2.includestests for a substring. You’re looking for a subsequence test, instead.str2supposed to be included instr1? What are the criteria?