I'm currently practicing on passing functions as arguments inside of other functions, using them as callbacks.

Here's my code...

Code JavaScript:
var iceCreamFlavors = function (add1, add2, checkString) {
    var addFlavors = ['Chocoloate', 'Vanilla', 'Cookies', 'Mint', 'Cookie Dough'],    
        loop,
        args = arguments.length;    
 
    if (typeof checkString !== 'function') { 
        checkString = false;
    }
    for (loop = 0; loop < args; loop++) {
        if (checkString) {
            checkString(add1, add2);    
            addFlavors.push(checkString(add1, add2));   .
        }
    }
    return addFlavors; 
};
 
var flavorCheck = function (check) {  
    if (typeof check === 'string') {    
        return check;
    }
    return false;
};
 
iceCreamFlavors('Almond', 'Cotton Candy', flavorCheck);

Here's my execution: http://jsfiddle.net/utXLu/1/

The code itself works partially correct as I expect it to. The problem here is that the second argument that's passing as Cotton Candy from the iceCreamFlavors invocation isn't being recognized and it's being passed (copied) as the first argument.

Can anyone help?

Thanks