In this task from *Eloquent JavaScript*, you are asked to write two functions. One to count the number of ""'s in a string input. The next function must take two inputs; one string to search and one string to identify the target character to search for.

I have errors in both. In the first function, my `count` is always returned as `1`. In the second one, it simply returns `undefined`. 

Can someone help me find my mistake?

```
function countBs(str) {
    var count = 0;
    for (var i = 0; i < str.length; i++) {
        if (str.charAt(i) === "B") {
            count++;
        }
        return (count);
    }
}

console.log(countBs("BBBBBBBBC"));

function countChar(str, char) {
    var count = 0;
    for (var i = 0; i < str.length; i++) {
        if (str.charAt(i) === "char") {
            count++;
            return (count);
        }
    }
}

console.log(countChar("kakkerlak", "k"));

```