Import external js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Import external js

How can I import all functions of an external javascript. Is there any easy way to do that?

24th Nov 2018, 9:38 PM
jack
jack - avatar
6 Answers
+ 2
Umm yeah ? Did you mean js to js You can use require Or import in ES6
24th Nov 2018, 10:13 PM
Taste
Taste - avatar
+ 1
Yes <script src="path/to/script.js"></script>
24th Nov 2018, 10:11 PM
Taste
Taste - avatar
0
Yes but that's in the html
24th Nov 2018, 10:12 PM
jack
jack - avatar
0
I have two js files and I need a function from one file in the other
24th Nov 2018, 10:14 PM
jack
jack - avatar
0
I did that already wit
24th Nov 2018, 10:15 PM
jack
jack - avatar
0
Yes you can wrap the function as a module, then import to the other file Is it for webpage ? If it is you can also import js in their html page like usual, it'll work. As long as the "imported file" are imported before the file that use it.
24th Nov 2018, 10:23 PM
Taste
Taste - avatar