I have an array of objects that contains information for rows. I am trying to filter this information so that I get a new array containing each row value only once. So the following object would output an array like so ['1', '2', '3']
Here is my code. I am trying the map function but not sure if this is the right approach:
var myArray = [
{
"row": 1,
"headline": "First Object"
},
{
"row": 1,
"headline": "Second Object"
},
{
"row": 2,
"headline": "Third Object"
},
{
"row": 2,
"headline": "Fourth Object"
},
{
"row": 3,
"headline": "Fifth Object"
}
];
var rows = myArray.map(function(row) {
console.log(row)
});