Javascript examples for String Operation:String Case
Javascript Search word in String by converting case
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// ww w . j av a 2 s . co m var exists = function (content, q) { var result = content.split(" ").filter(function(item) { return item.toLowerCase() === q.toLowerCase(); }); return result.length > 0; }; var query = "BEsT"; var string = "it is the BEST vest best"; console.log(exists(string, query)); } </script> </head> <body> </body> </html>