Search-3

 

JavaScript search function will search for a specified string and return the output "Contains learnkode" if string is matched.

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <script type="text/javascript"> var re = /learnkode/gi; var str = "i love learnkode."; if (str.search(re) == -1) { document.write("Does not contain learnkode" ); } else { document.write("Contains learnkode" ); } </script> </body> </html>
Output