|
-
May 28th, 2002, 11:07 AM
#1
Thread Starter
Frenzied Member
(javascript) getting the negative version of a positive number. **Resolved**
OK, I know there is a term for this but I never payed attention in school and I'm sure if I knew the term I could look it up myself but since I didnt I have to ask. I need the negative version of a positive number.... for example I have 500 but I need -500. I can easily do it this way (500 - 500 - 500) but I know that is poor, and am sure javascript has a function to do this.
Thanks
Michael
Last edited by msimmons; May 28th, 2002 at 11:51 AM.
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
May 28th, 2002, 11:51 AM
#2
Thread Starter
Frenzied Member
Found out that I can just add the - to the front of the variable and it will work.
-var1
michael
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
May 28th, 2002, 02:21 PM
#3
Frenzied Member
Way back when I was learning C++, this is what we did. It is a very mystical and complicated procedure:
If you wanted to make sure you weren't changing a negative to a positive, you could call the absolute value function/operator, and then the multiplication.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|