Ok, my basis for saying “most common” is not at all scientific, just a gut sense of how many times I’ve seen 15 mins or more spent trying to find a bug that ended up being just a syntax error in one’s script. Tools like JSLint and Firebug are really helpful in general, but not with these issues. (I’ve heard Aptana should be, but I couldn’t get it to work and it kept crashing on me.)
- Spurious comma after the last entry in a JSON object string
{name:’Fred’,visits:3,}
- Use of = instead of : in a JSON object string
{name=‘Fred’}
- Misspelled function and object names
encodeURICompoent
onReadyStateChange instead of onreadystatechange
- Spurious parenthesis after a function call
confirm(‘Proceed?’));
- Using parenthesis instead of braces for access within arrays and objects
htsVisits(‘Fred’)
- Spurious : between keyword case and a switch value
case: 1:
- Expecting “False” or new Boolean(“False”) to evaluate as true