How to Remove Decimal Places in Javascript

In this quick example this tutorial i will show you javascript remove digits after decimal. I will show you two procedure, One is javascript remove decimal places without rounding and second is javascript remove decimal places with rounding. So from this example you will learn remove zero after decimal point in javascript.

First example i will use javascript trunc and another example i will use javascript round method. Let's see the example code of how to remove decimal places in javascript.

const decimal = 5.67567;

const removedDecimal = Math.trunc(decimal);

// return 5

 

Also use can use round fucntion like that:

const removedDecimal = Math.round(decimal);
//or
const removedDecimal = parseInt(decimal);
//return 5

 

Hope it can help you.

 

Facebook Github
A web enthusiastic, self-motivated Full-Stack Web Developer from Dhaka, Bangladesh with experience in developing applications using Laravel Vue and React Js Application.