Home / Javascript Tips Generated By ChatGPT / 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