add script to html javascript code example

Example 1: script src tag in html

<script type="text/javascript" 
         src="file.js">  
</script>

Example 2: how to put javascript in HTML

<script>
  //put your java script here
  </script>

Example 3: how to add javascript in html

<script src="script.js"></script>

Example 4: call js script in html

<script src="file1.js" type="text/javascript"></script> 
<script src="file2.js" type="text/javascript"></script>

Example 5: add javascript

function add(param1, param2) {
    return param1 + param2
}