IntelliJ Java IDE
The moose likes HTML, CSS and JavaScript and the fly likes Need fix the precision for a value through JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Need fix the precision for a value through JavaScript" Watch "Need fix the precision for a value through JavaScript" New topic
Author

Need fix the precision for a value through JavaScript

Madhusudhan GoturKaranam
Greenhorn

Joined: Dec 31, 2002
Posts: 4
I have a variable with one number like below.
<script>
var v = "33.333333333333"
</script>
Through JavaScript i have to make the precision to 4.
i mean i have to make var v="33.3333"
Could Some body give information.....
Thanks in Advance
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
look at this post for rounding money...
http://www.coderanch.com/t/113985/HTML-JavaScript/Rounding-off-amounts
 
 
subject: Need fix the precision for a value through JavaScript
 
Threads others viewed
Embedding Javascript in a facelet Page
?? about js and redirect
Recursion & JSTL?
New line in javascript
Pasing scriptlet variable to javascript
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com