I need to make a function getPropertiesData(list)
that takes a list of properties and an object containing those properties and only return properties of the object that match in the list.
Illustration:
function getPropertiesData(['x', 'y']){
const o = {
'x': 1,
'y': 2,
'z': 3
}
// Will return
return {
'x': 1,
'y': 2
}
// not including the 'z' variable since it was not specified as input in the list array
}
How to do that in javascript ?