You can check whether a string contains a substring in JavaScript using the includes() method or by using the indexOf() method. Here's how you can do it:
Using includes() method:
let myString = "Hello, world!";
let substring = "world";
if (myString.includes(substring)) {
console.log("Substring found!");
} else {
console.log("Substring not found.");
}