#First Steps
##Development environment
JavaScript is most commonly added to HTML documents as either an embedded or external script.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Title</title>
<script type="text/javascript">
// Embedded JavaScript goes here
</script>
</head>
<body>
<!--External JavaScript file, located in the same folder as this HTML document-->
<script src="main.js" type="text/javascript"></script>
</body>
</html>
However, for many of the examples covered in this book, JavaScript console will be the easiest way to follow along.
##Variables
Programming often involves keeping track of and modifying data. Variables make it easy to store data and operate on at a later time. In addition, data in JavaScript consists of different, dynamic types depending on the purpose.
/* I am a block comment
* with multiple lines.
*/
var name = 'Johnny Appleseed'; // This is an inline comment
This is a basic variable declaration. var indicates variable assignment, name is the variable name, and it is equal to the String value "Johnny Appleseed". All statements in JavaScript end with a ;. Comments // (inline) or /**/ (block) are useful documenting our code.
What other types of data can we declare as variables? Quite a few:
var number = 1; // Number
var precise = 1.2; // More precise Number
var collection = []; // An empty Array
var person = {}; // An empty Object