0
Conditional ternary operator
This operator can only be used with numbers?
2 Antworten
+ 3
You can use it for any assignement, even in an implicit assignement during a function call and or inside an expression:
var x = 42;
alert( x + ( (x>9) ? "this is a number" : "this is a digit" ) );
+ 2
Its not limited only for numbers. You can use this for other data types too.