What you're guessing I think is the function .search()
would be something like this:
var text = "EnCuEnTrA La PaLaBrA";
//normalizando
text = text.toLowerCase();
text = text.trim();
$("#output").append("Primera busqueda : ");
if (text.search(" palabra ".trim()) != -1)
$("#output").append("verdad");
else
$("#output").append("mentira");
$("#output").append("<br/> Segunda busqueda : ");
if (text.search("nada") != -1)
$("#output").append("verdad");
else
$("#output").append("mentira");
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="output">
</div>
This function returns the position of the word you are looking for and if it is not present it returns -1.
for the case sensitive you could use txt.toUpperCase()
or txt.toLowerCase()
to normalize the fragments and for more security you could use the function txt.trim()
to avoid having extra spaces
I hope it helps you