I am trying to count the number of commas and question marks in a given array. Here is what I have so far but it only returns how many commas I have. I am having trouble understanding how to also return how many question marks there are.
var str = 'hello, how are you today? I am not bad and you?'
function checker(str){
var count = 0
for(var i = 0; i < str.length; i++){
if(str[i] == ",")
count++
}
return `There is ${count} comma`
}
checker(str)
//this returns "There is 1 comma"
I know the code only shows to count commas. I am not sure how to also include code to count the question marks.