function setup() {
// Creating Canvas size
createCanvas(450, 200);
}
function draw() {
// Set the background color
background(220);
// Initializing the Numbers
let num1 = 345;
let num2 = 12.3;
let num3 = .5;
let num4 = .05;
let num5 = 0;
let num6 = 0.7;
// Calling to nf() function.
let A = nf(num1, 4, 3);
let B = nf(num2, 4, 2);
let C = nf(num3, 5, 3);
let D = nf(num4, 2, 3);
let E = nf(num5, 2, 2);
let F = nf(num6, 4, 3);
// Set the size of text
textSize(16);
// Set the text color
fill(color('red'));
// Getting formatted String
text("Formatted String is: " + A, 50, 30);
text("Formatted String is: " + B, 50, 60);
text("Formatted String is: " + C, 50, 90);
text("Formatted String is: " + D, 50, 110);
text("Formatted String is: " + E, 50, 140);
text("Formatted String is: " + F, 50, 170);
}