最后这句话是怎么回事?字符串不以"b“开头。有人能解释一下"1“的立场吗?为什么它会使这一说法成为事实?
var _ = require('lodash');
var result = _.startsWith('abc', 'b');
console.log(result);
result = _.startsWith('abc', 'b', 1);
console.log(result);
>node tester.js
false
true
发布于 2022-01-19 14:30:32
正如文档所说,第三个参数指示要搜索的位置。因此,如果从索引1
开始,那么字符串abc
实际上以b
开头,因此它将返回true
。
https://stackoverflow.com/questions/70772383
复制相似问题