+ 1

Document external JavaScript

Hello where and how we make to create an external Javascript document ? Thank

2nd Dec 2018, 8:28 PM
Axelle
6 Respuestas
+ 2
<script> in html has a src attribute; there you put the path of your js file.
2nd Dec 2018, 8:46 PM
HonFu
HonFu - avatar
+ 2
just save file with extention .js
2nd Dec 2018, 8:52 PM
kit
+ 1
Hey , do you mean like keep javascript in external file ? It is the best practice to do so to keep your code clean. I f you mean to use one js code in another js file. This is used often in js frameworks like angular.
2nd Dec 2018, 8:42 PM
kit
+ 1
i undersrand the version with <script> and the version with js but my problem is to ceate the external file
2nd Dec 2018, 8:50 PM
Axelle
+ 1
You can use a simple text editor for it.
2nd Dec 2018, 8:55 PM
HonFu
HonFu - avatar
+ 1
and put it like a link like it: <script src="externe file.js"> ? with the same form that a simple link for a web page ...?
2nd Dec 2018, 8:59 PM
Axelle