menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Cut, Drop,...
source image

Medium

1M

read

132

img
dot

Image Credit: Medium

Cut, Drop, or Round? Breaking Down JavaScript’s Math Methods

  • JavaScript's math methods Math.trunc(), Math.floor(), and Math.ceil() explained with simple examples.
  • Math.trunc() removes decimal points without rounding and works the same for negative numbers.
  • Math.floor() rounds down to the nearest whole number, while Math.ceil() rounds up, even for negative numbers.
  • Math.round() rounds to the nearest integer and in the case of negative numbers, it rounds up towards the more negative integer.

Read Full Article

like

7 Likes

For uninterrupted reading, download the app