String.prototype.startsWith() - mkloubert/jsToolbox GitHub Wiki
String.prototype.startsWith(str) method
Checks if the string starts with a specific expression.
Syntax
String.prototype.startsWith(str);
Parameters
Name | Type | Description |
---|---|---|
str | String | The expression that should be checked. |
Result
Starts with expression or not.
Examples
var s = 'TM5979';
// (false)
var res1 = s.startsWith('5');
// (true)
var res2 = s.startsWith('TM');