toFixed

Format a number to a fixed number of decimal places in a page expression.

Page editor expression. Part of the page editor expression reference.

Formats a number using fixed-point notation with a set number of decimal places.

toFixed(value: number, digits?: number): string;

Parameters

  • value — the number to format.
  • digits — the number of digits after the decimal point. Defaults to 0.

Return value

The formatted number as a string. For example, toFixed(3.14159, 2) returns "3.14".