Some Formatting Basics:
- Most javascript goes in the document head (which is why I've been having trouble), but sometimes it can go in the body (like the alerts in Lessons 1 and 2).
- Javascript is case sensitive, so don't get lazy with the shift key. The convention is to uppercase the beginning of words in a line, like this: var paraCollection = document.getElementByTagName( 'p' );
- Semicolons mark the end of statements.
- Curly braces enclose sections of a script.
- When counting, start at 0, not 1.
- White space doesn't matter, so use as much as you want.
- Like HTML can have comments with , Javascript can have comments with // at the beginning of one line, or /* */ enclosing a multi-line comment.
- You can use ' or ", but make sure you're consistent when pairing them up.
No comments:
Post a Comment