string.startsWith
Syntax
str.startsWith(searchString[, postion])Parameters
Return value
Description
Examples
startsWith() ์ฌ์ฉํ๊ธฐ
Polyfill
Last updated
str.startsWith(searchString[, postion])Last updated
const str = 'Domestic cats, especially young kittens, are known for their love of play.';
str.startsWith('Domestic cats'); // true
str.startsWith('cats'); // false
str.startsWith('cats', 9); // trueif (!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;
}
});
}