Aha, so to be more self-documenting this line of code needs
either a comment to
explain what's going on, or, convert the function results to
numeric before
adding them (my preference as it's self-explanatory).
As the code stands now we've wasted about twenty messages on
something that
should be self-documenting so my critique is that, this code
doesn't let someone
else know what's going on so if you add up a bunch of these
in the same codebase
you have a typical scene of where it takes more time to
figure out the code than
to actually do something with it.
-tom m
-----Original Message-----
From: Uriel Weizmann [mailto:uw00001 hotmail.com]
Sent: Wednesday, November 21, 2007 10:01 AM
To: aspnet aspadvice.com
Subject: [aspnet] RE: Strange Javascript - Any ideas?
Just one little thing more: The expression: A - - B means
for javascript: A -
(-B), in other words: A minus the negative of B. There is no
stand alone
javascript operator - - such as that stands for PLUS. >
Subject: [aspnet] RE:
Strange Javascript - Any ideas?> From: jmacdiarmid caci.com> Date: Wed, 21 Nov
2007 09:10:17 -0500> To: aspnet aspadvice.com> > Ah,
ok now I'm understanding
this better. Since the functions are > converting the
numbers to strings, a plus
(+) operator would end up > concatenating them instead of
performing a
mathmatical action.> > > Jim MacDiarmid> CACI
> 4795 Meadow Wood Lane >
Chantilly, VA. 20151-2222> Voice (703) 679-5454> >
> > Uriel Weizmann
<uw00001 hotmail.com> > 11/21/2007 08:47 AM> Please
respond to>
aspnet aspadvice.com> > > To> aspnet aspadvice.com> cc> > Subject> [aspnet]
RE:
Strange Javascript - Any ideas?> > > > > >
> > here R few points:> > If U have 2
literals let say'12' and '345' then '12' + '345' will give u
> '12345' and '12'
- - '345' will give u '357'.> > in othher words - -
will do pure arithmetics
addition only, and 'ab' - - > 'cd' for example wll give u
the error flaged as
"NaN." (data not > numeric).> > this is a
good way to tell javascript that u
want to add 2 litterals and > not concatenate them.>
Date: Wed, 21 Nov 2007
01:02:31 +0000> From: > bearparkman yahoo.co.uk> Subject: [aspnet] RE: Strange
Javascript - Any > ideas?> To: aspnet aspadvice.com> > Actually, from a little >
experimentation> > (a - - b) is equivalent to (a +
b)> > hth> Ian> > James >
Macdiarmid wrote:> > I'm just interested in the dashes
in the eval > statement.
(i.e. > > eval(myfunction1() - - myfunction2()) <
0) ) I > "generalized" the
rest > > since I didn't want to put in the actual
code.> > > It appears it's
trying to subtract the return value of myfunction2 from >
> > the return value
of myfunction1.> >> >> > Jim
MacDiarmid> > CACI > > > 4795 Meadow Wood
Lane > >
Chantilly, VA. 20151-2222> > Voice (703) >
679-5454> >> >> >> > "Jones,
Larry"
<LJones Lithonia.com> > > 11/20/2007 > 02:35
PM> > Please respond to> >
aspnet aspadvice.com> >> >> > To> >
> aspnet aspadvice.com> > cc> >> >
Subject>
> [aspnet] RE: Strange > Javascript - Any ideas?>
>> >> >> >> >> >> >
Looks like
its just > psuedo-code. It is not actually functional.
Just> > listing out
possible > functions.> >> >> > Larry
Jones > > Hydrel/AcuityBrands > > > >>
> >
-----Original Message-----> > From: James Macdiarmid
>
[mailto:jmacdiarmid caci.com] > > Sent: Tuesday,
November 20, 2007 9:14 > AM> >
To: aspnet aspadvice.com> > Subject: [aspnet] Strange
Javascript - > Any ideas?>
>> > Hi everyone,> >> > I have a piece
of javascript that was > written by a
previous developer> > where I work and I'm not sure
what it > means. It looks
similar to the> > following code:> >> >
What do the dashes > with the space in
between mean? I've tried> > searching > > on the
net but > no luck.> >> > if
(eval( myfunction1(parameters) - - >
myfunction2(parameters)) < 0 ) { > > // do
something here> > }> > else> > > {>
> // do something else here> > }> >>
>> >
Thanks, > >> > Jim > MacDiarmid> >
CACI> > 4795 Meadow Wood Lane> > Chantilly,
VA. 20151-2222> > > Voice (703) 679-5454>
>> >> > --- List Settings ---> > >
http://aspadvice.com/
lists/> >> >> > --- List Settings
---> > >
http://aspadvice.com/
lists/> >> >> >> >> >>
>> > --- List Settings ---> > >
http://aspadvice.com/
lists/> >> >> > > > > ---
List Settings ---> >
http://aspadvice.com/
lists/> >
____________________________________________________________
_____> Are you ready
for Windows Live Messenger Beta 8.5 ? Get the latest for
> free today!>
http://entertainment.sympatico.msn.ca/WindowsLiveM
essenger> > > --- List
Settings ---> http://aspadvice.com/
lists/> > > > > > > --- List
Settings --->
http://aspadvice.com/
lists/>
____________________________________________________________
_____
Express yourself with free Messenger emoticons. Get them
today!
http://www.freemessengeremoticons.ca/?icid=EMENCA122
--- List Settings ---
http://aspadvice.com/list
s/
--- List Settings ---
http://aspadvice.com/list
s/
|