我已经习惯了C#的语法糖(并不像我想要的那样习惯于javascript),我发现这非常冗长.
有没有更好的方法来做到这一点?
var justColumnNames = new Array();
for( i= 0; i< columnsInfo.length; i++)
{
justColumnNames[i] = columnsInfo[i].Name;
}
Run Code Online (Sandbox Code Playgroud)
(顺便说一句,我在页面中有Extjs,我真的不能使用任何其他库)谢谢
Ext.each( columnsInfo, function(elem){
justColumnNames.push(elem.name);
});
Run Code Online (Sandbox Code Playgroud)