what does it mean for the following line?
T = ($("#a .b").hasClass("active") ? "C" : "D") ;
$("#a .b").hasClass("active") means whether #a .b exists? but how about ? "C" : "D", is it some kind of comparison logic?
It's a ternary operator
condition ? expr1 : expr2
If condition is true then expr1 would return else expr2 will return.
So, in your case:
T = ($("#a .b").hasClass("active") ? "C" : "D") ;
T variable will hold "C" if $("#a .b") has class active else it would hold "D"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With