Here's a handy template. I don't use this for actual web pages (altho you could) but it is perfect for doing quick experiments on your local machine.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Template</title>
<style type='text/css'>
</style>
<script type='text/javascript'>
window.onload = function()
{
}
</script>
</head>
<body>
</body>
</html>
Javascript is a scripting language independent from the browser. You'll find Javascript used as a scripting language in products other than web browsers. When you look at the Javascript reference you will not see much about web pages. The Javascript engine gives us access to objects and functions such as the Math object, the Date object, the String object, the Array object, etc. These objects will be available even if the Javascript engine is not running in a browser.
But, as you know, we can also use Javascript to change properties of HTML elements. That is because the browser gives the Javascript engine access to those HTML element objects. The browser gives the Javascript engine access to what is called the Document Object Model. And now you have another reference to study: the DOM.
In the template I've posted above, what am I doing with "window"? Is window provided to us by the Javascript engine or by the browser? It is part of the browser instead of the Javascript engine. And so you would go to the DOM reference to find out more about the window object. Likewise if I wanted to learn about what properties are available (and the methods for manipulating them) for some HTML element then I would go to the DOM reference because HTML elements are part of the web page - part of the document object hierarchy. If I needed a reminder on how to convert a string to lowercase, or how to make a loop that goes through an array and does something with each thing in the array then I would go to the Javascript reference.
My point here is that "learning Javascript" in the context of a web browser means more than just learning Javascript. I'm not trying to make it harder - but I think having a general feel for this distinction will make some things easier on you.
Ok, enough of that 
So now I have some questions for you. Use the Javascript reference (or any other resource) to find the answers.
1. What is the basic meaning of the terms "syntax" and "semantics"?
2. What is an "identifier" or "variable"?
3. What is an "expression" and what does it mean to "evaluate" an expression?
4. What is a Javascript "statement" - what is its syntax?
Bookmarks