I am trying upgrade my javascript programming skills ( or lets say my programming skills period : ) )
so I am trying to understand some semantics :
in the first line what does the “?” mean as well as the minus sign in “-distance”
in the second line what does ‘+=’ or ‘-=” mean?
el.css(ref, motion == 'pos' ? -distance : distance)
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
thank you
a ? b : cmeans “bifais true,cotherwise”.-ameansa, negated.a -= banda += bmeana = a - banda = a + brespectively. However, in your example these operators aren’t actually present in the code, they are just text strings the code is manipulating.