call js function in html code example
Example 1: call js script in html
<script src="file1.js" type="text/javascript"></script>
<script src="file2.js" type="text/javascript"></script>
Example 2: running a function in a function javascript
function runFunction() {
myFunction();
}
function myFunction() {
alert("runFunction made me run");
}
runFunction();
Example 3: how do i call a js method?
<button onclick="sayHello()">say hello</button> <script> 'use strict'; //force the context to be undefined function sayHello() { console.log(this); console.log(arguments); console.log('hello'); } </script>