Back to functions

nerdamer.setConstant


setConstant

Sets a constant value which nerdamer will automatically substitute when parsing expression/equation. Set to "delete" or "" to unset.

Usage: nerdamer.setConstant(name, value)


Parameters

String name The variable to be set as the constant
Number|Expression|string value The value for the expression to be set to.

Returns

nerdamer

EXAMPLES:
nerdamer.setConstant('g', 9.81);
var x = nerdamer('10+g');
console.log(x.toString())
nerdamer.setConstant('g', 'delete');
x = nerdamer('10+g');
console.log(x.toString());
OUTPUT:
Back to functions