# How to Convert a Float Number to Whole Number in JavaScript

There are various easy methods to convert float number to the whole number in JavaScript. Let’s discuss each of them and see examples.

Here are several built-in functions used for rounding.

## Math.floor()

The math.floor unction rounds the number passed as parameter to its nearest integer in downward direction: Javascript Math.floor method

## Math.ceil()

The Math.ceil() function rounds a number up to the next largest whole number or integer: Javascript Math.ceil method

## Math.round()

The math.round() function returns a number value which is rounded to the nearest integer: Javascript Math.round()method

## Math.trunc()

The math.trunc() function removes any fractional digits and returns the integer part of a number: Javascript Math.trunc method

## parseInt()

The parseInt() function parses the string argument and returns an integer of the given radix. Javascript parsInt method

## The double bitwise not (~~) Operator

The ~~ operator rounds a number towards 0 if the operand is a number and it’s not NaN or Infinity. Javascript double bitwise not (~~) Operator

## The bitwise OR (|) Operator

The OR operator rounds a number towards 0. Javascript bitwise OR (|) Operator

## The shift (>>) Operator

The shift operator rounds a number towards 0: Javascript shift operator

## The unsigned shift (>>>) Operator

The unsigned shift rounds a number towards 0: Javascript unsigned shift operator

## The XOR (^) Operator Javascript XOR (^) Operato

## Numbers

There are two types of numbers in JavaScript: Regular and BigInt. Regular is also known as “double-precision floating-point numbers”. The math is a built-in object which has properties and methods for mathematical constants and functions. The math object works with the Number type not BigInt.