List Info

Thread: RE: Strange Javascript - Any ideas?




RE: Strange Javascript - Any ideas?
country flaguser name
United States
2007-11-21 08:04:01
>In that regard, it appears to be working as designed...

I'll concur with that..      I'll
have to look more indepth at the eval 
function and see how it treats it. 



Jim MacDiarmid
CACI 
4795 Meadow Wood Lane 
Chantilly, VA. 20151-2222
Voice (703) 679-5454



"Duane" <duanelakodukcomcast.net> 
11/20/2007 10:22 PM
Please respond to
aspnetaspadvice.com


To
aspnetaspadvice.com
cc

Subject
[aspnet] RE: Strange Javascript - Any ideas?






uhh, I beg to differ.  -- (unary decrement operator), is a
valid 
JavaScript
(ECMA) operator, as it is in C, C++, C# and Java.
 
Whether it is valid in the context of the sample script is
another 
question.
Certainly not as shown (with spaces), however.
It may well simply be a bit of bogus code left behind by a
[developer] to
coerce someone into a futile attempt to de-mystify this
puzzling code
fragment...
 
In that regard, it appears to be working as designed...
 
Duane


  _____ 

From: Tim Walker [mailto:walketimgmail.com] 
Sent: Tuesday, November 20, 2007 7:33 PM
To: aspnetaspadvice.com
Subject: [aspnet] RE: Strange Javascript - Any ideas?


That's just fricken crazy dude. 

-- (two dashes) is NOT a javascript operator. 

However, - is an operator (subtraction) and - is an operator
(unary
negative) so...well....

Let's say you have a=2 and b=-2 
Than 
x = a -- b;
x = a - 2;

Does that fit the pattern? 

http://www.daaq.net/old/javascript/index.php?page=
js+operators
<
http://www.daaq.net/old/javascrip
t/index.php?page=js+operators&parent=core+

javascript> &parent=core+javascript 

Tim


On Nov 20, 2007 5:08 PM, Gravitt, Eric <eric.gravitttranscore.com> wrote:


Could it be a typo? Does it work?

Eric

-----Original Message-----
From: James Macdiarmid [mailto:jmacdiarmidcaci.com]
Sent: Tuesday, November 20, 2007 12:14 PM 
To: aspnetaspadvice.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/list
s/



--- List Settings ---
http://aspadvice.com/list
s/  <http://aspadvice.com/
lists/> 




--- List Settings --- http://aspadvice.com/list
s/ 




--- List Settings ---
http://aspadvice.com/list
s/






--- List Settings ---
http://aspadvice.com/list
s/


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )