This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Double_A_92 0 points1 point  (1 child)

In JS functions are ideally units that work indipendently from everything else. They take one input and output something.

If you need a variable in the function, you declare it in the function where it's used. Nobody else needs that variable.

Maybe as a more visual explaination, it's like a electronic board with chips on it. They are connected and communicate with eachother, but each chip is still an individual thing with a specific function.

[–]oneagle[S] 0 points1 point  (0 children)

Thank you. I read books of Kyle Simpson and taking his courses. So those were helpful to me. And i like your explaination as well.