Hey there! I'm currently working on a code to count the occurrences of a specific letter in a string using indexOf(). However, it seems like something may be off with my implementation. Can anyone point me in the right direction? Thanks!
var string = 'Lets find l as many times as we can. Love is natural, love you lots';
var myFunc = function (letter) {
newString = 0;
for (var i = 0; i < letter.length; i += 1) {
if (string.indexOf('l')) {
newString += 1;
}
}
return newString;
}