1// this how add javascript file in html !!
2
3
4<script type="text/javascript" src="yourJavascript.js"></script>
1<!-- include an external javascript document -->
2<script src="myJavaScript.js" charset="utf-8"></script>
3
4<!-- JavaScript inside html element -->
5<script>
6 console.log("This is JavaScript");
7</script>
1<script>
2 function alert () {
3 alert("Javascript has started");
4 }
5</script>
1<!-- If JS is in external file: -->
2<script src="filename.js" charset="utf-8"></script>
3
4<!-- If you want JS in the your HTML file -->
5<script>
6 /*Your JS Code Here*/
7</script>