Let's say I have an object array call movies like below.
movies = [{ id : 1,title : 'Black Panther'},{ id : 2,title : 'Avengers'},{ id : 1,title : 'Justice League'},{ id : 4,title : 'Infinity War'},{ id : 5,title : 'Spider man'}]
Is there anyway I can extract the value of particular key from every object ? Like this titles array.
titles = ['Black Panther','Avengers','Justice League','Infinity War','Spider Man']
At the moment I'm doing it using map
function. Is there any other way to achieve this without iterating over every object. Can this be achieved using ES6 rest/spread feature ?