Quantcast
Channel: How to count string occurrence in string? - Stack Overflow
Viewing all articles
Browse latest Browse all 43

Answer by Bhojak Rahul for How to count string occurrence in string?

$
0
0
const getLetterMatchCount = (guessedWord, secretWord) => {  const secretLetters = secretWord.split('');  const guessedLetterSet = new Set(guessedWord);  return secretLetters.filter(letter => guessedLetterSet.has(letter)).length;};const str = "rahul";const str1 = "rajendra";getLetterMatchCount(str, str1)

Viewing all articles
Browse latest Browse all 43

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>