Skip to content

Instantly share code, notes, and snippets.

@thmain
Created December 25, 2022 05:30
Show Gist options
  • Save thmain/3f80dc5848cfb4059276ff6c6d6ae43c to your computer and use it in GitHub Desktop.
Save thmain/3f80dc5848cfb4059276ff6c6d6ae43c to your computer and use it in GitHub Desktop.
'use strict';
function projection() {
var newReleases = [{
"id": 70111470,
"title": "Die Hard",
"rating": [4.0]
}, {
"id": 654356453,
"title": "Bad Boys",
"rating": [5.0]
}, {
"id": 65432445,
"title": "The Chamber",
"rating": [4.0]
}, {
"id": 675465,
"title": "Fracture",
"rating": [5.0]
}];
return newReleases.map( release => ({
id: release['id'],
title: release['title']
})
);
}
console.log(projection());
/*
[{id: 10111470, title: "Die Hard"},
{id: 654356453, title: "Bad Boys"},
{id: 65432445, title: "The Chamber"},
{id: 675465, title: "Fracture"}
]
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment