Write a JavaScript function that checks if a given string, starts with a given substring.
The input comes as 2 string arguments:
-
The first string will represent the main one.
-
The second one will represent the substring.
Examples:
Input:
How have you been?
how
Output:
false
Input:
The quick brown fox…
The quick brown fox…
Output:
true
Input:
Marketing Fundamentals, starting 19/10/2016
Marketing Fundamentals, sta
Output:
true
The output is either “true” or “false” based on the result of the check.
The comparison is case-sensitive!