add script with javascript code example
Example 1: calling javascript file in html
<script type="text/javascript" src="yourfile.js"></script>
Example 2: dynamically add script code to page
var newScript = document.createElement("script");
newScript.src = "http://www.example.com/my-script.js";
target.appendChild(newScript);