xxxxxxxxxx
<html lang="en">
<head>
<meta charset="utf-8">
<title>Check If a String Contains a Substring in JavaScript</title>
</head>
<body>
<script>
// Sample string
var str = "The quick brown fox jumps over the lazy dog."
// Check if the substring exists inside the string
var index = str.indexOf("fox");
if(index !== -1){
document.write("Substring found!");
} else{
document.write("Substring not found!");
}
</script>
</body>
</html>