What will be the output of the following recursive function?
function countCharacter(str, char) {
if (str.length === 0) {
return 0;
}
let firstChar = str.charAt(0);
let remainingStr = str.substr(1);
if (firstChar === char) {
return 1 + countCharacter(remainingStr, char);
}
return countCharacter(remainingStr, char);
}
console.log(countCharacter("Hello World", "o"));