+ 2

How to import methods/functions in JavaScript?

When I started learning JavaScript, I expected it to be, to some extent, similar to Java! The syntax was basically the same, but the classes and packages were not there. Is copy and paste the only way of using functions/methods defined in another program in the current program?

20th Sep 2017, 9:34 PM
Danilo
Danilo - avatar
1 Resposta
+ 7
well.... there's the import https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import or you can add a <script src="your_other_file.js"></script> to your HTML page to include whatever in the other file in the code base
20th Sep 2017, 9:40 PM
Burey
Burey - avatar