get array of attribute from an array of objects

Monday, March 10, 2014

Say i have an array of objects in javascript as



var array=[{id:1,message:"hello",time:"00-00-0000"},{id:2,message:"sup",time:"00-00-0000"},...];


What is the best way to get an array only containing the message attribute. i.e.



var messages=["hello","sup",...];






http://ift.tt/1fiMC2P