Friday, January 14, 2011

Javascript 101

In Douglas Crockford's first introductory video, I learned a great deal about the history and origins of Javascript.  I did not know that it wasn't a spin off of Java and that it was closely related to C++.  I learned that Javascript's features include:
  • loosely typed
  • it is not done with executable files, but done with type
  • "load and go"
Many say that Javascript isn't object-based, but there is a strong case to be made that will prove that it does, in fact, use objects.

Javascript uses numbers, strings, bollean values, and unknowns.  Operators used include basic arithmetic signs and logical operators.  There are best practices that shorten some statements, but most of the Javascript language makes logical sense.

Below is my first assignment:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prerequisite Assignment 1</title>
<script type="text/javascript">
var t = '2';
var y = '2';
var h = parseInt(t) + parseInt(y);
alert('2 + 2 = ' + h);
</script>
</head>
<body>
<center><p>This is my prerequisite assignment.</p></center>
</body>
</html>