The function mop below does a specified mathematical operation on passed parameters 'a' and 'b'. If optional operation parameter 'op' is not provided by caller it does a default operation:
function mop(a, b /*,[op]*/) {
switch( arguments[2] ) {
case '-': return a-b;
case '*': return a*b;
case '/': return a/b;
default: return a+b;
}
}
This question checks your understanding of arguments object and optional parameters.
What is the value of returned result - mopr - from an expression that calls mop as below:
var mopr = mop( mop( mop( 4, 2, '-' ), 20 ), 10, '*' );