[Javascript] Show and hide multiple div tags
Abyss - Information
Info at Abyss.ws
Thu May 11 17:40:25 CDT 2006
Yes yes, thank you heap :)
My yahoo-ing revealed this
http://en.wikipedia.org/wiki/Ternary_operation
thanks again - i really am greatful for the help(from everyone)
Abyss
----- Original Message -----
From: "Triche Osborne" <wdlists at triche-osborne.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Friday, May 12, 2006 8:41 AM
Subject: Re: [Javascript] Show and hide multiple div tags
> Abyss - Information wrote:
>> Yes I understand that.
>>
>> I was just wondering (to which i will yahoo a ternary statement in a
>> minute)
>>
>> why and how does it work with the? and the :
>>
> The question mark is the ternary operator. Just as an equal sign (the
> assignment operator) is parsed by the interpreter as "store this piece
> of data at a place designated by this name," the question mark is
> intepreted as "if the statement that preceeds this question mark . . ."
> The question mark is always immediately followed by the true condition.
> The colon is the "else" and is always followed by the false branch.
>
> If you could see it as the interpreter does, it would be something like
> this:
>
> (1) var2 = var ? 'this' : 'that';
> ^ if var is
>
> (2) var2 = var ? 'this' : 'that';
> ^ TRUE, this
>
> (3) var2 = var ? 'this' : 'that';
> ^ else
>
> (4) var2 = var ? 'this' : 'that';
> ^ else FALSE, then this
>
> (5) var2 = var ? 'this' : 'that';
> ^ assign results to var2
>
>
> As for the origins, I believe it comes from C, as do a number of
> constructs in both JavaScript and PHP. (PHP supports ternary form as
> well.) It's interesting to note that it isn't considered a complete
> statement in itself. The following isn't complete:
>
> ( var ) ? 'this' : 'that';
>
> If must be used as part of a complete statement such as this one:
>
> var2 = (var) ? 'this' : 'that';
>
> The returned value must be assigned to something or used in some manner.
> Is this more what you were looking for?
>
> Triche
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
More information about the Javascript
mailing list