Back to functions

Expression.buildFunction


buildFunction

Generates a JavaScript function given the expression. This is perfect for plotting and filtering user input. Plotting for the demo is accomplished using this. The order of the parameters is in alphabetical order by default but an argument array can be provided with the desired order.


Usage: nerdamer(expression).buildFunction(args_array)


Parameters

String[] args_array The argument array with the order in which they are preferred.

EXAMPLES:
var e = nerdamer('x^2+y');
var f = e.buildFunction();
console.log(f(2, 3));
//change the variable order by passing in an array with the order
var g = e.buildFunction(['y', 'x']);
console.log(g(2, 3));
OUTPUT:
Back to functions