test.html
<script src="mytest.js">
</script>
<script>
myFunction()
document.write("<br>");
var n=addnum(5,3)
var n1 = n.toString();
document.write(n1);
</script>
mytest.js
var firstname;
firstname="Hege";
document.write(firstname);
function myFunction()
{
//alert("Hello Shanshan");
document.write("<br>");
document.write("just test");
}
function addnum(x,y){
return x+y
}
Result: