The search() method of a String searches for a match between a regular expression and the string and returns the index number of the first character matched in the string.

    
    const sentence= "Rock concerts are loud.";

    // pattern for the first occurrence of an uppercase character
    const regExp = /[A-Z]/;

    const sentenceSearch = sentence.search(regExp);

    console.log(sentenceSearch);
    // 0