📜  查找字符串 javascript 代码示例的星号索引

📅  最后修改于: 2022-03-11 15:01:15.830000             🧑  作者: Mango

代码示例1
if (!String.prototype.startsWith) {
    Object.defineProperty(String.prototype, 'startsWith', {
        value: function(search, rawPos) {
            var pos = rawPos > 0 ? rawPos|0 : 0;
            return this.substring(pos, pos + search.length) === search;
        }
    });
}