Explore Courses Blog Tutorials Interview Questions

Explore Tech Questions and Answers

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

0 votes
by (1.5k points)
I am new to JavaScript. Can someone tell me how to convert a float number in Javascript.

1 Answer

0 votes
by (1.4k points)

There are many ways by which we can convert a float number to a whole number in Javascript  

  • Method 1: For truncate: 


var intvalue = Math.floor(value); 

  • Method 2: For roubd 

var intvalue = Math.round(value); 

Related questions

0 votes
1 answer
0 votes
0 answers
0 votes
1 answer

Browse Categories