How to fill the array in jquery

arrays, jquery

Solution

You can use `map` method:

var arr = $("select > option").map(function() {
    return this.innerHTML;
}).get();

DEMO: http://jsfiddle.net/UZzd5/

Problem

Is there any other better way to fill up the array like : ``` var arr = []; var i = 0; $('select').children('option').each( function() { arr[i++] = $(this).html(); }); ```

Original source