<html>
<body>
<h1>JavaScript 字符串</h1>
<h2>indexOf() 方法</h2>
<p>indexOf() 方法返回值在字符串中第一次出现的位置。</p>
<p>查找 "welcome":</p>
<p id="demo"></p>
<script>
let text = "Hello world, welcome to the universe.";
let result = text.indexOf("welcome");
document.getElementById("demo").innerHTML = result;
</script>
</body>
</html>