Fix misspelling
Use different var i, max in each for loop
Add missing spaces; remove extra spaces
Add missing semicolons
Add missing var keyword
Add braces around if statement for clarity
One line between each function()
Add/remove spacing for readability and consistency

Add
  after : { () ,
  around =
  before } (

Remove
  after (
  before : )
  between function()
Indent four spaces consistently
Make punctuation consistent

- Remove periods from comments.
- Add periods to `warn()` statements.
- Change to single quotes in comments.
Wrap all ternary operators in () for clarity
Wrap all typeof arguments in () for clarity and consistency
Remove trailing whitespace