In Javascript, how do I define Absolute Value?

# Thread: In Javascript, how do I define Absolute Value?

1. Senior Member
Join Date
Dec 1969
Posts
702

## In Javascript, how do I define Absolute Value?

I would like to make a number, whether it is positive or negative come out positive, how do I assign absolute value to a negative number. I have:<BR><BR> if (SunHrs &#060;0){<BR> frm.SunTxt.value = "absolute value ??" (SunHrs);<BR> }

2. Senior Member
Join Date
Dec 1969
Posts
252

## Simple maths?

If the value is &#060; 0 multiply it by -1

3. Senior Member
Join Date
Dec 1969
Posts
2,809

## RE: In Javascript, how do I define Absolute Value?

Silly question I&#039;m sure, but have you tried multiplying it by -1?

4. Senior Member
Join Date
Dec 1969
Posts
702

## OK silly question

I guess it&#039;s as easy as multiplying by -1, I was wondering if there was something in jscript concerning absolute value. Just thinking too much for a small problem.<BR><BR>Thanks

5. Senior Member
Join Date
Dec 1969
Posts
252

## Try posting in the jscript forum next time...

as you are more likely to get jscript specific replies

6. Senior Member
Join Date
Dec 1969
Posts
11,334

## Built in function

Math.abs()<BR><BR>Check &#039;er out.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•