Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript array of object to array of string, simpler way?

I am so used to the syntactic sugar of C# (and not as used to javascript as I want to) that I find this very verbose.

Is there any better way to do this?

var justColumnNames = new Array();    
for( i= 0; i< columnsInfo.length; i++)
{
   justColumnNames[i] = columnsInfo[i].Name;
}

(BTW I have the Extjs available in the page, and I cant really use any other library) Thanks

like image 780
roundcrisis Avatar asked Dec 05 '25 10:12

roundcrisis


1 Answers

Ext.each( columnsInfo, function(elem){
    justColumnNames.push(elem.name);
});
like image 194
Upperstage Avatar answered Dec 08 '25 05:12

Upperstage



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!