Skip to content

Instantly share code, notes, and snippets.

@buymed-hoangpham
Created September 11, 2022 08:55
Show Gist options
  • Save buymed-hoangpham/79b07fbe85cd55fc49c6ccfc92eae87b to your computer and use it in GitHub Desktop.
Save buymed-hoangpham/79b07fbe85cd55fc49c6ccfc92eae87b to your computer and use it in GitHub Desktop.
pratice
const players = [
{ jersey: 56, name: 'Djounte Murray', position: 'Point guard', PPG: 2.6 },
{ jersey: 98, name: 'Dennis Rodman', position: 'Small Forward', PPG: 10.8 },
{
jersey: 1,
name: 'Michael Jordan',
position: 'Small Forward',
PPG: 345.6,
},
{ jersey: 2, name: 'Lebron James', position: 'Shooting Guard', PPG: 26.7 },
{ jersey: 33, name: 'Patrick Ewing', position: 'Center', PPG: 20.2 },
];
const result = players.map(
(player) =>
`${player.jersey} - ${player.name} -- Position: ${
player.position
} -- RPP: ${Math.floor(player.PPG)}`
);
console.log('🚀 ~ file: index.js ~ line 18 ~ result', result);
@QuocCao-dev
Copy link

QuocCao-dev commented Sep 11, 2022

const players = [
  { jersey: 56, name: "Djounte Murray", position: "Point guard", PPG: 2.6 },
  { jersey: 98, name: "Dennis Rodman", position: "Small Forward", PPG: 10.8 },
  {
    jersey: 1,
    name: "Michael Jordan",
    position: "Small Forward",
    PPG: 345.6,
  },
  { jersey: 2, name: "Lebron James", position: "Shooting Guard", PPG: 26.7 },
  { jersey: 33, name: "Patrick Ewing", position: "Center", PPG: 20.2 },
];

const showPlayerInfo = (player) =>
  `${player.jersey} - ${player.name} -- Position: ${
    player.position
  } -- RPP: ${Math.floor(player.PPG)}`;

const result = players.map(showPlayerInfo);
result;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment