Where can I learn more about the if/then statement in this format:
var x = "hello";
x=(x=="hello")? alert("hello") : alert("bye")
thank you
Printable View
Where can I learn more about the if/then statement in this format:
var x = "hello";
x=(x=="hello")? alert("hello") : alert("bye")
thank you
Well, it shouldn't have the x= on the front.
I just have an ORielly book around. I don' t know of any online JavaScript references, but I'm sure there are some.
Its the TERNARY OPERATOR.
http://msdn.microsoft.com/library/de...onditional.asp
This link gives a sample of its usage and other operators too...
- Jemima.