Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
rezistik
· 12y ago · 0 comments
Why `success ? 'method1' : 'method2'` instead of `success ? obj.method1() : obj.method2() `? That seems more concise to me.
Comments
[–]
CaveTech
12y ago
I find the other method more concise, as it's a more DRY syntax if you're going to interact with the functions in more than one place.
[–]
9point6
12y ago
or even `obj[success ? 'method1' : 'method2']()`