I have been using the "defer" method for a while. The use of the "module" method is acceptable, but it is more beneficial for developers who have experience with frameworks of any kind and will not be confusing for them. On the other hand, using the "import" method might be useful for learning JSX syntax and preparing ourselves for frameworks.
Hi@@dcode-software , I haven't been watching or commenting on videos related to front-end development, including yours, for a while. I took a break from programming, this is why. Recently, I've decided to return to my long-term project, and I'll be looking to refresh my knowledge from videos like yours
I guess a disadvantage may be that you need to remember to put all your code inside of their (or at least, a "main" function). Whereas if you just use the "defer" attribute then you can avoid doing that completely.
Thanks Dom! Great content and very helpful!! I am currently working on a project that uses modules and it is very difficult for me to debug issues for exactly the reason you pointed out. Is there a workaround for accessing variables in my main.js module? I have a bunch of other js files that main.js is importing and really need to keep it as a module. Thank you for all your in-depth and super informative videos!!
what about making variables accessible in the global window object? like const username = window.username = "dcode"; this way you can access it from everywhere just as before.
Clean, fast and slim, only necesssary information.👍👍👍 Thank you!
You're welcome!
You can use alt+up/down arrow to move current line up or down instead of copy paste.
Learning something new every day, thank you bro
Glad to hear it 😎
Helpful
I have been using the "defer" method for a while. The use of the "module" method is acceptable, but it is more beneficial for developers who have experience with frameworks of any kind and will not be confusing for them. On the other hand, using the "import" method might be useful for learning JSX syntax and preparing ourselves for frameworks.
Absolutely! I haven't seen you comment in a while Tomas - hope you're well!
Hi@@dcode-software , I haven't been watching or commenting on videos related to front-end development, including yours, for a while. I took a break from programming, this is why. Recently, I've decided to return to my long-term project, and I'll be looking to refresh my knowledge from videos like yours
what was the disadvantage to wrap everything into the domContentLoaded listener?
I guess a disadvantage may be that you need to remember to put all your code inside of their (or at least, a "main" function). Whereas if you just use the "defer" attribute then you can avoid doing that completely.
Thanks Dom! Great content and very helpful!! I am currently working on a project that uses modules and it is very difficult for me to debug issues for exactly the reason you pointed out. Is there a workaround for accessing variables in my main.js module? I have a bunch of other js files that main.js is importing and really need to keep it as a module. Thank you for all your in-depth and super informative videos!!
Hey, I'm glad you found it helpful. If you really need to see the variables in a module, you can assign the variable to the window object.
what about making variables accessible in the global window object? like
const username = window.username = "dcode";
this way you can access it from everywhere just as before.
Man's been on a role lately, innit.
👀 thanks for being subscribed for so long to notice the change in my uploading schedule