How to run javascript locally on our web browser?

Hi, this is the tutorial series about Javascript which is the language I am going to use to create HTML5 game. The first topic today is about how to run javascript on any web browser.

In order to run javascript on web browser we just need a simple tool, which is a web browser, I will use Firefox here. Before we can run our program we do need to set up a few files and write a few lines of code, so lets get started!

First lets create an html5 file and name it df.html

<!doctype html>
	<head>
		<meta charset="utf-8">
		<title>JS Demo</title>
	</head>
	<body>
		<script type="text/javascript" src="hello.js"></script>
	</body>
</html>

Next create the hello.js file and insert the below code.

alert("Hello World!");

We will link the javascript file in the above html page.

Now make sure both files are in the same folder then click on the df.html file to open it on the web browser, you should see the below screen.

hello

This conclude our first lesson in javascript which will be used to create the html5 game!