The assignment is counting a specific letter in a string. But the problem is that I don't know how to set capital letter is same with lowercase letter. For example, There are three 'a' in 'aAa', a string.
my code is working well if it distinguishes capital letter and lowercase letter.
function countChar(string, char) {
var count = 0;
for (var i = 0; i < string.length; i++) {
if (string[i] === char) {
count = count + 1;
}
}
return count;
}