Javascript
[ES6] New string method
yemsu
2020. 3. 26. 10:53
.startsWith()
String.prototype.startsWith(searchString, position = 0)
Returns true if the receiver starts with searchString; the position lets you specify where the string to be checked starts.
.endsWith()
String.prototype.endsWith(searchString, endPosition = searchString.length)
Returns true if the receiver starts with searchString; the position lets you specify where the string to be checked starts.
.includes()
String.prototype.includes(searchString, position = 0)
Returns true if the receiver contains searchString; position lets you specify where the string to be searched starts.
.repeat()
String.prototype.repeat(count)
Returns the receiver, concatenated count times.
참고