What is the meaning of :
return i ? null : "red";
? What is the meaning of "?" and ":"
That's a ternary operation.
Its syntax is:
condition ? operation-if-true : operation-if-false
For instance
return myVariable >5 ? 'a' : 'b';
return "a" if myVariable
is greater than 5, otherwise "b".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.