hello i am trying to get a function in a script folder to work on an html page
I have this set up html
<script src="add.js">
txt = document.createElement('p')
document.body.appendChild(txt)
txt.innerHTML = add(2);
</script>
and script file function
function add(a){
return a+a
}
Its not working and im not sure why. i have tried wrapping the whole statements inside a function and calling that. tried onload in different positions and didnt work.
thank you