获取一个字符串Hello world中world首次出现的位置 获取一个字符串Hello world中world首次出现的位置 var str=“Hello world!” document.write(str.indexOf("world")) 在控制台输出为6