Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Rounding off to the next number

Posted on 2005-03-07
2
Medium Priority
?
163 Views
Last Modified: 2008-02-20
Hi,

I have a simple doubt

if i have a number like 5.5 or 5.8 it should off to 6
and if i have a number like 5.1 or 5.49 it should round off to 5 i dont want any decimal places like 5.00.

how do i do it in Javascript???
0
Comment
Question by:rajikrishna
2 Comments
 
LVL 32

Accepted Solution

by:
ldbkutty earned 200 total points
ID: 13483997
<script>
alert(Math.round(5.4));
alert(Math.round(5.6));
</script>
0
 

Author Comment

by:rajikrishna
ID: 13484037
Its so easy
Thankx
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question