String startsWith() method

Find out all the information about the JavaScript startsWith() method of the string

Check if the string starts with the value of the string passed as a parameter.

You can callstartsWith()On any string, provide a substring and check if the result is returnedtrueorfalse:

'testing'.startsWith('test') //true
'going on testing'.startsWith('test') //false

This method accepts a second parameter, which allows you to specify the character to start checking:

'testing'.startsWith('test', 2) //false
'going on testing'.startsWith('test', 9) //true

Download mine for freeJavaScript beginner's manual

More js tutorials: