0

For example, will this cause any errors?

bob = {
    name : 'bob', 
    job : 'developer',
};

I'm talking about that trailing comma after 'developer'

I know this is not best practice, but will it cause any errors at all? Thanks

user3818382
  • 27
  • 1
  • 3

2 Answers2

2

In IE 7 and older, it will throw an exception and the program will stop running.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Thank you, I appreciate it. If anyone knows of any other potential errors at all, please let me know. – user3818382 Sep 15 '14 at 16:25
  • In ES3 browsers, such as IE 7, this is an early error (the script load is aborted). ES5 now requires this syntax be supported. See cbuckley's comment to your question for a good link to read about this. – chuckj Sep 15 '14 at 17:15
0

I've seen this cause minification errors with Asp.Net's bundling, might cause the same error with other JS minification tools. It'll say "error something on line nnn, invalid character" or something similar and fails to minify the JS.

artm
  • 8,554
  • 3
  • 26
  • 43