JS Built-ins
← Math124 / 215
Mathfroundbeginner

Math.fround() β€” Return Type

πŸ“– Usage Example
// Nearest 32-bit single-precision float
Math.fround(1.337)   // β†’ 1.3370000124...
Math.fround(1.5)     // β†’ 1.5

Use Math.fround() to convert a number to the nearest 32-bit float, useful when working with WebGL or typed arrays.

Math.fround()

Returns the nearest 32-bit single precision float representation of a number.

Challenge: Confirm that Math.fround() always returns a JavaScript number.

πŸ’‘ Hints (1)
  • β€’ Math.fround always returns a JavaScript number primitive