Checking if a String Contains a Substring in Javascript


Use String.includes() to check if a string contains a specific substring.

Source Code

let text = "Hello, world!";
console.log(text.includes("world")); // true
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments