代码示例:(标识:js_includes_1)
<!DOCTYPE html>
<html>
<body>

<h2>JavaScript 字符串搜索</h2>

<p>检查字符串是否包含 "world":</p>

<p id="demo"></p>

<p>Internet Explorer 不支持 includes() 方法。</p>

<script>
let text = "Hello world, welcome to the universe.";
document.getElementById("demo").innerHTML = text.includes("world");
</script>

</body>
</html>
运行结果: