HTML5 JavaScript boilerplate file
HTML5 is designed in mind to work with JavaScript natively. It is probably the most optimized version of HTML in existence at this point. There are a lot of similarities with JavaScript implementation in HTML5 as in older versions of HTML.
JavaScript programs added to the HTML5 web page at the head of a file. The main reason it is done this way, is to ensure that JavaScript file is loaded before content of HTML5 website is loaded. JavaScript usually stored in files just like CSS3 scripts. Below is HTML5 JavaScript boilerplate file that you can use as your starting point while developing in HTML5 and JavaScript. <!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
document.write("Text written by JavaScript");
</script>
<title>HTML5 JavaScript boilerplate</title>
</head>
<body>
</body>
</html>
This HTML5 JavaScript boilerplate code will display information in the browser window and it is essential in understanding relationship between HTML5 and JavaScript. Let’s look at JavaScript function called document.write().
First, the document is a direct reference to our HTML5 web page. Second, write() method is a way JavaScript tells web page what it wants to do. In our case we simply write text into the web page itself.