JavaScript String startsWith() 方法

  • 2026-07-12 19:11:17

实例

例子 1

从位置 0 开始:

let text = "Hello world, welcome to the universe.";

text.startsWith("Hello");

亲自试一试

例子 2

从位置 6 开始:

let text = "Hello world, welcome to the universe.";

text.startsWith("world", 7);

亲自试一试

友情链接
Copyright © 2022 极限竞技游戏活动前线 All Rights Reserved.