Default enum value in javascript class constructor
<p>I have a simple class, and I'm trying to figure out how to set a default value in the constructor:</p>

<pre><code>var Foo = function(bar = Foo.someEnum.VAL1) {

    this.bar = bar;
    someEnum = {VAL1 : 1, VAL2: 2};
}
</code></pre>

<p>and to use it like:</p>

<pre><code>var myFoo = new Foo(Foo.someEnum.VAL1);
</code></pre>

<p>but this is apparently wrong. What's the correct way to set a default enum value, or do I need to set the default to null, and check for the null in the constructor and set accordingly?</p>

<p>To clarify, bar is an enum for the Foo class. There are other properties in the class that are not shown. Also, updated class code.</p>