Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (1.5k points)
recategorized by
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: 

Ex: 

var intvalue = Math.floor(value); 
 

  • Method 2: For roubd 

var intvalue = Math.round(value); 

Related questions

31k questions

32.9k answers

507 comments

693 users

Browse Categories

...