I have an array as follows:
items = [
{"year": 2010, "month": 11, "day":23}
{"year": 2009, "month": 10, "day":15}
{"year": 2009, "month": 10, "day":10} //added after my edit below
]
I would like to create a new array with only 2 of the columns like this:
newArarry = [
{"year": 2010, "month": 11}
{"year": 2009, "month": 10}
]
Right now Im trying with .map() and its not working:
const newArray = [];
newArray.map({
year: items.year,
month: items.month
});
EDIT
After following one of the answers below, I realized I forgot to mention that I would also need to filter the result to be only unique rows. Now that I am only selecting the year and month columns, I am getting multiple duplicate rows