это базовая репетиция из Eloquent JavaScript.
Однако в результате я получаю только "0".По какой-то причине цикл не обновляет переменную count:
function countChar(str, n){
let count = 0;
for(let i = 0;i == str.length-1; i++){
if(str[i] == n){
count++;
}
}
return count;
}
console.log(countChar("dazzled", "z"));