+ 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 Answer
+ 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