How can I avoid the "last comma" gotcha (and similar) in javascript?
<p>In the perl word (which I'm coming from), adding a final comma when creating an object does not have any bad side effects - in fact it's encouraged in case you want to add fields later;</p>

<p><a href="http://perltricks.com/article/27/2013/6/16/Perl-hash-basics--create--update--loop--delete-and-sort/" rel="nofollow">this article</a>, (one of many possible sources) says:</p>

<pre><code>my %weekly_temperature = (
    monday    =&gt; 65, 
    tuesday   =&gt; 68,
    wednesday =&gt; 71, 
    thursday  =&gt; 53, 
    friday    =&gt; 60,
);
</code></pre>

<p><em>A couple more tips when working with key value pairs of a hash: the code is more readable if you vertically align the fat comma (‘=>’) operators and unlike C, Perl allows the last element to have a trailing comma, which makes it easier to add elements later without generating a compile error.</em></p>

<p>In the javascript world - as I understand it - the last comma is advised against - again, a sample tip from <a href="https://www.smashingmagazine.com/2010/04/seven-javascript-things-i-wish-i-knew-much-earlier-in-my-career/" rel="nofollow">this (one of many) article</a>:</p>

<pre><code>var car = {
  colour:'red',
  wheels:4,
  hubcaps:'spinning',
  age:4
}
</code></pre>

<p><em>The main gotcha in this notation is IE. Never ever leave a trailing comma before the closing curly brace or you’ll be in trouble.</em></p>

<p>How can I catch this and similar "gotcha's" in my javascript code?</p>