Basic Calculator Testing

by mrrodd

JavaScript

var a = function(x, y) {
    return x + y;
};
var s = function(x, y) {
    return x - y;
};

var calc = function(x, y, op){
    return op(x, y);
};


//console.log( add(14,5) );
console.log( "Add:",calc(14, 5, a) );
console.log( "Subtract:",calc(14, 5, s) );