📘
Number formatter, can be used to display a number as a string with
a specified number of digits before and after the decimal point,
optionally adding padding with zeros.
Parameters
num: number
digits: number
Returns string
a string representation of the number, formatted accordingly
Example
awaitCanvas(200, 100); background(0.8);
textSize(32); text(nf(PI, 4, 5), -90, 10);
nf(num:number,digits:number):string
ðŸ›
nf is short for number format. It formats a number
to a string with a specified number of digits.
📘 Number formatter, can be used to display a number as a string with a specified number of digits before and after the decimal point, optionally adding padding with zeros.