Hello everyone happy new year to all.
i want get length of only fractional part of number in java script function.
example if number is 4.321 then length of fractional part is 3. please help me.
thank you
Hello everyone happy new year to all.
i want get length of only fractional part of number in java script function.
example if number is 4.321 then length of fractional part is 3. please help me.
thank you
Jump to PostHere is the code
<html> <script lang='javascript'> function fraclength(num) { alert(num.split(".")[1].length) ; } fraclength("54.93934"); </script> </html>
Here is the code
<html>
<script lang='javascript'>
function fraclength(num)
{
alert(num.split(".")[1].length) ;
}
fraclength("54.93934");
</script>
</html>
thank you very much. it's working.
Time to learn difference between JSP (Java Server Pages) and JS(JavaScript). Post moved to Java Script section
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.
You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.