JavaScript/判断字符串:修订间差异
来自康健生活
创建页面,内容为“== 判断字符串 == ==== 判断一个字符串是以某个字符串开头 ==== {{leftrightflex|<syntaxhighlight lang="javascript">let foo = '→***' let bar = '*:*…” |
|||
| 第8行: | 第8行: | ||
zxy.indexOf("/")</syntaxhighlight>|{{consoleout|<pre> | zxy.indexOf("/")</syntaxhighlight>|{{consoleout|<pre> | ||
0 | 0 | ||
2 | |||
-1 | -1 | ||
</pre>}}}} | </pre>}}}} | ||
如果存在则返回匹配值所在位置的下标 | |||