3 ms·
>If a function is so long it requires multiple statements, is it really so bad to give it a name and a separate line of code from its use? Personally I'd find t
by zaro 6y ago
>If a function is so long it requires multiple statements, is it really so bad to give it a name and a separate line of code from its use? Personally I'd find that clearer, even if the language didn't enforce it.
Sometimes this is the case. But let's take for example filtering an array. Do you really want to give names for the callback that will filter? Also I find it more readable if the logic doing the filtering is right there where the filter call is, and not somewhere above.