2 ms·
Why not: function vis(el, on) { if (el) { (on ? remClass : addClass)(el, 'nosee') } } ?
by Arkanosis 8y ago
Why not:
function vis(el, on) { if (el) { (on ? remClass : addClass)(el, 'nosee') } }
?
- AltruisticGap 8y agoAhh thanks! I forgot about that. I'm guessing I didn't think about it because I'm used to the following pattern ,which is actually useful from time to time in my projects. And typically it happens in an object/class: this[expr ? 'method1' : 'method2'](args) So I have to add "this" as the methods are not global. Now if I overlooked something again I'm definitely getting rusty :)
- dang 8y agoYes, that's better, especially since we do it elsewhere. Thanks!