programming-examples/js/String/Test whether a string starts with a specified string.js
2019-11-15 12:59:38 +01:00

4 lines
140 B
JavaScript

function startsWith(input, string) {
return input.indexOf(string) === 0;
}
console.log(startsWith('js string exercises', 'js'));