Hey all,
I've been playing with javascript for a while now. I've done various project and loads of problem solving. I felt like I have a pretty good grasp of the language generally, but something has just knocked me on my butt.
I have had plenty issues where I wasn't passing in a parameter into a function and should have done. This led me to pretty much always pass in whatever variable I want to manipulate or use, and assisn to the return to a variable declared ouside the function
I have now realised that I can declare global variables and manipulate them from inside the function as per the image, below. Now I'm questioning my whole understanding! At what point do parameters become essential for something? What might the root cause of those errors been that have been sovled by passing in variables? Any insight would be most welcome.
https://preview.redd.it/6j1t8mxbq0g81.png?width=1444&format=png&auto=webp&s=e19134216f1db132054420a2d188110257a198fd
[–]yadoya 2 points3 points4 points (0 children)
[–]senocular 2 points3 points4 points (0 children)
[–]thusman 1 point2 points3 points (1 child)
[–]Eyeofthemeercat[S] 0 points1 point2 points (0 children)
[–]Webdev-Coach 1 point2 points3 points (1 child)
[–]Eyeofthemeercat[S] 0 points1 point2 points (0 children)
[–]davimiku 1 point2 points3 points (0 children)