Execute JavaScript in HTML code example

Example 1: Javascript how to run hello world

var msg = "hello world";
console.log(msg);

Example 2: hello world javascript

// Output Hello World! in the console.
console.log("Hello World!");

Example 3: javascript hello world

console.log("Hello World!");

Example 4: calling javascript file in html

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

Example 5: call js script in html

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

Tags:

Java Example