Back to functions
nerdamer.setFunction
setFunction
Sets a function which can then be called using nerdamer.
Usage: nerdamer.setFunction(function_name, param_array, function_body)
Parameters
String
function_name
|
The function name |
String[]
param_array
|
The parameter array in the order in which the arguments are to be passed |
String
function_body
|
The body of the function |
Returns
nerdamer
nerdamer.setFunction('f', ['x', 'y'], 'x^2+y');
var x = nerdamer('f(4, 7)').toString();
console.log(x.toString());
nerdamer.setFunction('g', ['z', 'x', 'y'], '2*x+3*y+4*z');
x = nerdamer('g(3, 1, 2)');
console.log(x.toString());