+ 1

Function or no?

I can’t find this question, so I’ll ask. When coding in JavaScript, when should I use a function? I know that you can reuse functions, but what if I’m not going to use it again? Is it a good habit, or do I only use it when necessary? Thanks

9th Jan 2018, 11:26 PM
Pete Cowling
Pete Cowling - avatar
1 Resposta
+ 3
If the function would shorten the code or make it more readable it would be better to use it.
9th Jan 2018, 11:38 PM
Boris Batinkov
Boris Batinkov - avatar