startsWith

最后更新于:2022-04-02 00:07:33

## startsWith + [link](./startsWith "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L12546 "View in source.") + [npm](https://www.npmjs.com/package/lodash.startswith "See the npm package.") ``` _.startsWith([string=''], [target], [position=0]) ``` 检查字符串是否以 `target` 开头。 ### 参数 1. [string=''] (string) 要检索的字符串 2. [target] (string) 要检查的字符串 3. [position=0] (number) 检索的位置 ### 返回值 (boolean) 如果符合条件返回`true`,否则返回 `false` ### 示例 ``` _.startsWith('abc', 'a'); // => true _.startsWith('abc', 'b'); // => false _.startsWith('abc', 'b', 1); // => true ```
';