q5play
    Preparing search index...

    Function nf

    • 📘 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

      • n: number

        number to format

      • l: number

        minimum number of digits to appear before the decimal point; the number is padded with zeros if necessary

      • r: number

        number of digits to appear after the decimal point

      Returns string

      a string representation of the number, formatted accordingly

      await Canvas(200, 100);
      background(0.8);

      textSize(32);
      text(nf(PI, 4, 5), -90, 10);
    • 📘 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

    • 🛠 nf is short for number format. It formats a number to a string with a specified number of digits.

      Parameters

      • n: number
      • l: number
      • r: number

      Returns string

      formatted number

      await Canvas(200, 100);
      background(0.8);

      textSize(32);
      text(nf(PI, 4, 5), -90, 10);
    • 🛠 nf is short for number format. It formats a number to a string with a specified number of digits.

      Parameters

      • num: number
      • digits: number

      Returns string

      formatted number