I want to check if a string (let entry)
contains exact match with let expect
:
let expect = 'i was sent'
let entry = 'i was sente to earth' // should return false
// let entry = 'to earth i was sent' should return true
// includes() using the first instance of the entry returns true
if(entry.includes(expect)){
console.log('exact match')
} else {
console.log('no matches')
}
There are lots of answers on StackOverflow but I can't find a working solution.
Note:
let expect = 'i was sent'
let entry = 'to earth i was sent'
should return true
let expect = 'i was sent'
let entry = 'i was sente to earth'
should return false