83
rated 0 times
[
89]
[
6]
/ answers: 1 / hits: 99849
/ 15 Years ago, tue, november 24, 2009, 12:00:00
I can’t seem to wrap my head around the first part of this code ( += ) in combination with the ternary operator.
h.className += h.className ? ' error' : 'error'
The way I think this code works is as follows:
h.className = h.className + h.className ? ' error' : 'error'
But that isn't correct, because that gives a error in my console.
How should I interpret this code correctly?
More From » variable-assignment