How to optimize collections creating by numerical switch?
<p>I need to create a certain number of objects based on user-selected drop-down list. Now I have this code. </p>

<pre><code>var driversFunc = function () {

var driversCount = osagoViewModel.fields.driversCount.selectedValue();

switch (driversCount) {

    case "many":
        return [];
    case "1":
        return [new driver()];
    case "2":
        return [new driver(), new driver()];
    case "3":
        return [new driver(), new driver(), new driver()];
    case "4":
        return [new driver(), new driver(), new driver(), new driver()];
    case "5":
        return [new driver(), new driver(), new driver(), new driver(), new driver()];
    }
};
</code></pre>

<p>(knockout.js is used)</p>
