Re:Reverse Engineering One Line of JavaScript
by crooked-v on Friday July 14, 2017 @04:16AM
(#14768353)
And even if using an if, you can make it smaller with
[ Parent
| on HN ]
Re:Reverse Engineering One Line of JavaScript
by maze-le on Friday July 14, 2017 @05:04AM
(#14768522)
Inline conditionals can be a blessing and a curse. In this case, it is absoluteley alright to use them (I find it also more elegant). But I have also seen things like:
my_fancy_named_variable = my_array.map{|x| do_processing(x)}.sort_by{|x| x.value} unless some_very_long_conditional_that_breaks_readability
This is not very readable, and I would actually use multiple lines to format a call like this.