How to import JavaScript files (import JS File into other JS File)

preview_player
Показать описание
Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship). I'll help you master the latest tech here:

👉 Discord: all my courses have a private Discord where I actively participate

⏱️ Timestamps:
0:00 - Intro
0:25 - Create second JavaScript file
1:39 - Export
2:00 - Import
2:44 - Error (solution: type='module')
3:06 - Error (solution: Live Server)
3:53 - Default export
4:37 - ES Modules vs CommonJS Modules

#esmodules #esm #jsimport #jsexport #javascript
Рекомендации по теме
Комментарии
Автор

Bro I was legit so frustrated and confused for the past 2 hours cuz there weren’t any other tutorials for this. Thank you so much bro

johnnyissuper
Автор

These guys manage to develop the overall most versatile, all around useful language for something as important as the web. But they struggle in making something so fundamental like importing a file (even C does it better) more intuitive and less annoying.

Bernardo_
Автор

Thanks for this video. I was struggling for the past couple of hours because of LiveServer. I was also putting type="module" in the wrong script (the common script).

funtimewithsaraandfriends
Автор

i just loved how to showed us all the errors

IndraTags
Автор

Great! Just make sure your filepath is right and you don't forget .js at the end of the js files name, like I did for the last 30 Minutes :D:D

sunraiii
Автор

Thanks so much! I was missing the type=module in my html file.

niat.
Автор

Thank you! Had problem with that export/import.

Hubson
Автор

Thanks, I was having a hard on time with why I was getting the CORS error.

frantzbazile
Автор

What color settings do you have? Love the golden/yellow looking text in your sidebar

jp
Автор

You are incredible man, thank you so much!!!

gabrielzanella
Автор

Bro can u pls say that how to import if there is many files and folders some are keeping.../ . / ../ I have more confusion in it

User-fh