Is there a way to limit the number of decimal places in JavaScript?

mulder

Senior member
Oct 9, 1999
684
0
76
I am messing around a simple square footage calculator in JavaScript. We had to get the square feet then obtain a cost based on a price per square feet. I got everything to work, but there are some answers that output 10-13 decimal places and I only want to display 2. Is there such a way to do this?

I know how to do it in C++, but JavaScript is a little different. Thanks.
 

DAM

Diamond Member
Jan 10, 2000
6,102
1
76
not sure if this well help, but maybe if you set your variable to some other type, like integer or something else. i know this would work for java, but not sure about jscript.

another options would be to truncate what you dont want.



dam()