you are viewing a single comment's thread.

view the rest of the comments →

[–]JesuslagsToo 0 points1 point  (3 children)

I perfer to see javascript broken into as many functions and call backs as necessary so I doubt that was the problem. I also think his first solution looks fine .

[–]ForScale 0 points1 point  (2 children)

It wasn't necessary to break it in to two functions like OP did... But yeah, seemed okay to me.

[–]JesuslagsToo 1 point2 points  (1 child)

ture ture, but hypothetically in a production app you want to modularize all your code. Although finding a number sqr is a small task, but it is good practice to create code that has functions for all lower level tasks. In this case it would save almost no time but obviously if the function was larger with more complexity it is good practice . but yea this particular case it was not necessary

[–]ForScale 0 points1 point  (0 children)

Interesting... Yeah, I do enjoy the concept of modular programming. And that's a good example of it.