Is there a code that changes decimal places? Example if you have 333.333333..... can you make it say just 333
Thanks
Is there a code that changes decimal places? Example if you have 333.333333..... can you make it say just 333
Thanks
Jump to PostThis can make it 333
Test this code in your addresbar:
javascript: alert(333.33333.toFixed())
implement it if you like it.
You can also do things like:
3215.3248566432.toFixed() //gives you [3215]
3215.3248566432.toFixed(1) //gives you [3215.3]
3215.3248566432.toFixed(3) //gives you [3215.325]
3215.3248566432.toFixed(4) //gives you [3215.3249]etc
I don't know if you use jQuery, but I do, and I use this plugin for formatting floats:
http://code.google.com/p/jquery-utils/source/browse/trunk/src/jquery.strings.js
This can make it 333
Test this code in your addresbar:
javascript: alert(333.33333.toFixed())
implement it if you like it.
You can also do things like:
3215.3248566432.toFixed() //gives you [3215]
3215.3248566432.toFixed(1) //gives you [3215.3]
3215.3248566432.toFixed(3) //gives you [3215.325]
3215.3248566432.toFixed(4) //gives you [3215.3249]
etc
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.