I am currently developing a basic search algorithm in JavaScript.
var title = "Discovering the Best Book of All Time";
var search1 = "of DiscoverinG boOk Best";
var search2 = "Of TIme best all"
var search3 = "Book discovering time"
When using indexOf(), it only indicates that search1 is false, while search2 and search3 are true because the words may not be in correct order or clumped together. What approach should I take to create a search algorithm that identifies such cases?