filtering with map

by Randy Crews

JavaScript

//using map to pull values and create a new array
let myArray = [
    {'link': 'link value 1', 'ref': 'some right information'},
    {'link': 'link value 2', 'ref': 'some more information'},
    {'link': 'link value 3', 'ref': 'some other information'},
    {'link': 'link value 4', 'ref': 'some wrong information'},
]
const links = myArray.map(a => a.link);
console.log(links);


//or standard object

const resource = {'link': 'link value 1', 'ref': 'some right information'};
console.log(resource.link);