I coded a word base game but it wasn't light on cpu. Why was it so slow, it baffled me all the while. On research, I learned of memory leaks and i was sure my game had those in abundant. Now how do I minimize global declarations? 5 yrs later, your video is still top notch as you demonstrate with utmost clarity. Gracias, shukran, merci, thank you 🙏
Good explanation. I found your channel while preparing for my interviews last month and you videos are really helping me a lot. Thanks for these and keep doing it :)
Nice videos. Good improvement would be to sometimes mention why does it work like that. For example if we put a function declaration into parentheses, what does it mean in the language of JS
Is source code available? It's totally understandable if it's only available through your courses...Just asking. Thanks for sharing your knowledge. These videos are great !
These same topics are covered in the courses that provide the source code. I haven't made the code available for the TH-cam tutorials, but something to consider. Thanks for the suggestion.
I was just looking for that too. It's common to allow access to the code, because that way I can open it and watch and refer back e.g. pause, review, think, probably think some more and go back to the video. I get you have courses, so I guess it makes sense to limit the value some how to encourage subs on udemy or any other place. The only thing is, is that if that's the true value difference I personally wouldn't choose to sign up for access to source code. Maybe others would, but I thought I'd at least share my disposition on the point. FYI. My little sidebar is not a criticism of your choice, just me sharing what my mental process is on it as one person. I give feedback whenever I can, because providers rarely get enough and so I try to share whenever I like someone. For better or worse ;) PS. I've watched quite a few and I really like your work; very unique teaching approach which I like very much.
Similar view to misterhtmlcss on your putting code examples on the web for each significant video. I also question the wisdom of denying access to the - usually low-level, non-ground-shaking - source code for far of suppressing demand for your courses. If anything, seeing a thing work might help to DRIVE demand for the full course ! Especially if the examples were close to the issues frontend coders have to deal with as they learn the backend stuff. I mean no complex patterns of listeners (for what? for Martians ?) - just bread-and-butter JS coding for tasks like sign-up, login, sign-out, add to mailing list, order product, make a payment, etc. My 2 cents worth.
When I try to use this, it works perfectly for the most part, but I experience a big problem. All functions defined that use case/switch statements no longer work. For example, if I have an onclick event in my HTML that calls "myFunction()", and it has a switch statement, what happens within the case statements never happen. For example, if there is some global variable x, and it reads x and decides what to do depending on its value with a switch statement, even if x == 2 and it asks case: 2. I think it has something to do with the fact it can no longer read the variable used within the switch statement because global variables are all now local and encased by the function you said to add, but this shouldn't be a problem since they are in the same function. Any ideas?
@@AllThingsJavaScript Here is the github link to it: github.com/BrianZhang1/tournamentTimer Warning: It's long. Examples of functions that don't work are: toggleSound(), nextStep(), and reset(mode)
@@AllThingsJavaScript Access the file named TournamentTimer Broken, that is the one that doesn't work. The other one works if you'd like to see how it normally operates.
@@AllThingsJavaScript It is the github link, you can download the folder there with my files. I'll paste it again: github.com/BrianZhang1/tournamentTimer
Yes, modules prevent global variable. Techniques discussed in this tutorial are the same techniques that the traditional module pattern uses and many libraries. ES6 modules (type='module') prevent global variables as well.
I coded a word base game but it wasn't light on cpu. Why was it so slow, it baffled me all the while. On research, I learned of memory leaks and i was sure my game had those in abundant. Now how do I minimize global declarations? 5 yrs later, your video is still top notch as you demonstrate with utmost clarity. Gracias, shukran, merci, thank you 🙏
Glad it helped!
Two words mate, Life and Saver! I'd happily donate some funds if I knew how to?
Sir u are best JavaScript teacher ever
Wow, thanks
Good explanation. I found your channel while preparing for my interviews last month and you videos are really helping me a lot. Thanks for these and keep doing it :)
Great to hear!
Thank you sir, it's very much helpful.
A great follow-up video to *What Is Wrong With Global Variables In JavaScript ?*
Explanations clear and down-to-earth. Many thanks, Buddy.
Still the best video series on JS. Thanks a lot. Love from India ❤️
Fantastic video. You made everything very clear and easy to understand. Thanks for explaining this in great detail.
Holy Shit!
This is the perfekt video I needed!
Thank you so much
thanks
Nice videos. Good improvement would be to sometimes mention why does it work like that. For example if we put a function declaration into parentheses, what does it mean in the language of JS
This tutorial on IIFEs explains that better: th-cam.com/video/w71IVgfsOL0/w-d-xo.html
Is source code available? It's totally understandable if it's only available through your courses...Just asking. Thanks for sharing your knowledge. These videos are great !
These same topics are covered in the courses that provide the source code. I haven't made the code available for the TH-cam tutorials, but something to consider. Thanks for the suggestion.
I was just looking for that too. It's common to allow access to the code, because that way I can open it and watch and refer back e.g. pause, review, think, probably think some more and go back to the video.
I get you have courses, so I guess it makes sense to limit the value some how to encourage subs on udemy or any other place. The only thing is, is that if that's the true value difference I personally wouldn't choose to sign up for access to source code. Maybe others would, but I thought I'd at least share my disposition on the point. FYI. My little sidebar is not a criticism of your choice, just me sharing what my mental process is on it as one person. I give feedback whenever I can, because providers rarely get enough and so I try to share whenever I like someone. For better or worse ;)
PS. I've watched quite a few and I really like your work; very unique teaching approach which I like very much.
Similar view to misterhtmlcss on your putting code examples on the web for each significant video.
I also question the wisdom of denying access to the - usually low-level, non-ground-shaking - source code for far of suppressing demand for your courses. If anything, seeing a thing work might help to DRIVE demand for the full course ! Especially if the examples were close to the issues frontend coders have to deal with as they learn the backend stuff. I mean no complex patterns of listeners (for what? for Martians ?) - just bread-and-butter JS coding for tasks like sign-up, login, sign-out, add to mailing list, order product, make a payment, etc. My 2 cents worth.
@@AllThingsJavaScript do you have any courses at Udemy?
I love this, thanks!
Awesome channel, happy i found it! (was searching for "javacript theory")
Welcome aboard!
great info!
Glad it was helpful!
helpfull man, thanks. i like your detail explanation
at @10:23 you mention a different technique for dealing with global variables in the namespace; what is that other technique?
Basically you check to see if that variable exists and if it does you include what is defined in what you are creating.
Superb video . Thanks.
I wowed when I tested "the init" function :D
I can't solve null from document.getElementById.
If you are getting null from document.getElementById, either the element doesn't exist with that id or the DOM is loaded after the JavaScript runs.
@@AllThingsJavaScript Thank you sir! Yes the document is loading last.
May i ask is there a way to solve this?
When I try to use this, it works perfectly for the most part, but I experience a big problem.
All functions defined that use case/switch statements no longer work. For example, if I have an onclick event in my HTML that calls "myFunction()", and it has a switch statement, what happens within the case statements never happen. For example, if there is some global variable x, and it reads x and decides what to do depending on its value with a switch statement, even if x == 2 and it asks case: 2. I think it has something to do with the fact it can no longer read the variable used within the switch statement because global variables are all now local and encased by the function you said to add, but this shouldn't be a problem since they are in the same function.
Any ideas?
Could you provide your code?
@@AllThingsJavaScript Here is the github link to it:
github.com/BrianZhang1/tournamentTimer
Warning: It's long. Examples of functions that don't work are: toggleSound(), nextStep(), and reset(mode)
@@AllThingsJavaScript Access the file named TournamentTimer Broken, that is the one that doesn't work. The other one works if you'd like to see how it normally operates.
@@ainbrisk545 Where did you provide the file?
@@AllThingsJavaScript It is the github link, you can download the folder there with my files. I'll paste it again:
github.com/BrianZhang1/tournamentTimer
or you can just use type='module'. correct me if I ma wrong.
Yes, modules prevent global variable. Techniques discussed in this tutorial are the same techniques that the traditional module pattern uses and many libraries. ES6 modules (type='module') prevent global variables as well.
So this is how react was created 😁
this video is repeated twice in your channel, sir.