Math.trunc

trunc — Returns the number without it's fractional digits.

Description

Math.trunc(number number)

Parameters

Name Description Type Default Optional
number number No

Changelog

Version Description
ES 6 Introduced.

Examples

Example #1 – trunc example
console.log(Math.trunc(1.5)); // 1 console.log(Math.trunc(-1.5)); // -1

External references