JavaScript Details
JavaScript is one three languages used for web development:
- HTML defines the content of web pages
- CSS specifies the layout of web pages
- JavaScript programs the behavior of web pages
"JavaScript is the only programming language people attempt to use before they know anything about it".
- Douglas Crockford, JavaScript: The Good Parts
In C-like languages, the semicolon denotes the end of a statement. Unlike other C-like languages, JavaScript does not always enforce the use of a semicolon at the end of a statement. Rather, a carriage return may be "understood" as a missing semicolon, resulting in different semantics.
In JavaScript, a semicolon is automatically inserted when
- two statements are separated by a line terminator
- two statements are separated by a closing brace
}
- a line terminator follows a
break
,continue
,return
, orthrow
.
Some libraries have evolved to simplify using JavaScript. This allows those who don't know all the details of the language to use it in a masterful way. JQuery and Bootstrap make your life easier.
What can you do with JavaScript
- Select nodes by tag, id or class
- Determine if a document has finished loading
- Change the web page after it has loaded
- Validate user-entered text before it returns to the server
- Create functions that run on the client (in the browser)