How To Use String Includes() Using JavaScript?
Nov 19, 2021 . Admin

Hello Friends,
Now let's see example of how to use string includes() example. Here you will learn how to use javascript string includes(). This is a short guide on string includes(). Let's get started with how to find string includes() in javascript.
Here i will give you many example how you can use string includes() javascript.
Example : 1<!DOCTYPE html> <html> <head> <title>How To Use String Includes() Using JavaScript? - MyWebtuts.com</title> </head> <body> <h3>How To Use String Includes() Using JavaScript? - MyWebtuts.com</h3> <script> let str = "Welcome to the MyWebtuts.com"; document.write(" <b> The given string is : </b>", str); document.write("<br>"); let res = str.includes('tO'); document.write(" <b> The result is : </b> ", res); </script> </body> </html>Output :
The given string is : Welcome to the MyWebtuts.com The result is : falseExample : 2
<!DOCTYPE html> <html> <head> <title>How To Use String Includes() Using JavaScript? - MyWebtuts.com</title> </head> <body> <h3>How To Use String Includes() Using JavaScript? - MyWebtuts.com</h3> <script> let str = "Welcome to the MyWebtuts.com"; document.write(" <b> The given string is: </b>", str); document.write("<br>"); let res = str.includes('the', 8); document.write(" <b> The result of str.includes('the', 8) is : </b> ", res); </script> </body> </html>Output :
The given string is: Welcome to the MyWebtuts.com The result of str.includes('the', 8) is : true
It will help you...