Back to functions
Expression.text
text
Returns the text representation of the expression.
Usage: nerdamer.text(option, n)
Parameters
String
option
|
Pass in the string 'decimals' to get back the number as decimals. Pass in the string 'recurring' to get back the number as a recurring decimal. Pass in the string 'fractions' to get back the number as fractions. Defaults to decimals. |
String
n
|
The number of decimal places if requested as decimal |
Returns
String
var x = nerdamer('1/12+1/2*cos(x)-0.5');
console.log(x.text('decimals'));
console.log(x.text('decimals', 1));
console.log(x.text('decimals', 7));
console.log(x.text('recurring'));
console.log(x.text('fractions'));