Back to functions

nerdamer.setConstant


setContant

Sets a constant value which nerdamer will automatically substitute when parsing expression/equation


Usage: nerdamer.setContant(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.

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