Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Substring Checker</title>
- </head>
- <body>
- <script>
- const str1 = "Hello, Enjoy your day.";
- const str2 = "your";
- document.write("str1 : "+str1);
- document.write("<br>str2 : "+str2);
- var inc = str1.includes(str2);
- if(inc){
- document.write("str2 is present in str1");
- }else{
- document.write("str2 is not present in str1");
- }
- </script>
- <p>If it prints true then the main string consists of the substring else it doesnt.</p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement