I have an array object in javascript. I would to select a particular field from all the rows of the object.
I have an object like
var sample = {
[Nam
// assuming you mean:
var sample = [
{Name:"a",Age:1},
{Name:"b",Age:2},
{Name:"c",Age:3}
]
Well, your biggest problem there is that no matter what happens, you'll have to loop. Now, jQuery will let you hide that behavior with:
var output = []
$.each( sample, function(i,e){ output.push( e.Name )} );
But fundamentally, that is the same thing as:
for( var i = 0; i < sample.length; i++ )
{
output.push( v.Name )
}