Answers for "string startswith regex javascript"

10

javascript string starts with

//checks if a string starts with a word
function startsWith(str, word) {
    return str.lastIndexOf(word, 0) === 0;
}
startsWith("Welcome to earth.","Welcome"); //true
Posted by: Guest on July-23-2019
0

JavaScript String startsWith() examples

JavaScript startsWith() Case sensitive Example
const text = 'Hello, Welcome to JavaScript World';
console.log(text.startsWith('Hello')); // true
console.log(text.startsWith('hello')); // false
Posted by: Guest on November-29-2021

Code answers related to "string startswith regex javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language