[thelist] JS: compound ternary

Tom Dell'Aringa pixelmech at yahoo.com
Mon Feb 2 08:57:55 CST 2004


--- jsWalter <jsWalter at torres.ws> wrote:
> Well, my simple test on this...
> 
>   var y = 2;
>   var z = 7;
> 
>   var x = (y == 1) ? 'y' : (z == 1) ? 'z-1' : 'z-2';
> 
>   document.write ( x );
> 
> produced what I thought it would.
> 
> Try displaying values on this before trying to RETURN.

Both you and Liorian were correct, it was the RETURN that was the
syntax error. Thanks!

Tom

=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: JavaScript Author / Every Friday!
http://www.thywordistruth.net/ :: Eternal Life

[Those who say that I am finished, and am through, will have to run over my dead body to beat me...]


More information about the thelist mailing list