How do i eliminate functions defined in-place as parameters? As in, the function that returns the addition of its two parameters should be coded as a named function and the other function should be coded as an anonymous function assigned to a variable.
var outputAreaRef = document.getElementById("outputArea");
var output = "";
function flexible(fOperation, operand1, operand2)
{
var result = fOperation(operand1, operand2);
return result;
}
output += flexible(function(num1, num2) {return num1 + num2}, 3, 5) + "<br/>";
output += flexible(function(num1, num2) {return num1 * num2}, 3, 5) + "<br/>";
outputAreaRef.innerHTML = output;