You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
We have written the Navigator prototype in CoffeeScript, which is a language that is very similar to Javascript but has cleaner syntax (resembling Python).
No semicolon insertion wars, as CoffeeScript doesn't use semicolons to end statements.
No bugs because of forgotten local var declarations, as CoffeeScript declares all variables automatically.
No global variables.
No bugs caused by Javascript == as CoffeeScript == is compiled to Javascript ===.
Cleaner callback chains as the function keyword and argument list parentheses aren't needed.
Special function declaration => that keeps this defined in callbacks.
Proper for x in list loops without Javascript's isOwnProperty.
A syntax for declaring classes.
Additional niceties such as list comprehensions.
Disadvantages
CoffeeScript needs to be translated to Javascript before running.
Debuggers show different line numbers (unless source maps are in use).
The tutorial homepage doesn't specify or even mention all language features.
Gotcha: All functions return the value of their last line even if the author didn't mean to.
Gotcha: rules for splitting function call arguments based on optional parentheses, optional commas and line breaks are weird.
Gotcha: Whitespace in a +b causes interpretation a(+b).
Gotcha: The condition if not key in object is parsed as if (not key) in object
Gotcha: Undocumented feature of referencing a predefined constructor leads to no error if constructor is not a function, e.g. constructor: (@config) vs. constructor: (@config) ->