Skip to content

Instantly share code, notes, and snippets.

@buymed-hoangpham
Created September 11, 2022 09:17
Show Gist options
  • Save buymed-hoangpham/fc4567a4247f29c3d8837ce4fde88a5b to your computer and use it in GitHub Desktop.
Save buymed-hoangpham/fc4567a4247f29c3d8837ce4fde88a5b to your computer and use it in GitHub Desktop.
5
const cars = [
{ name: 'Ford', price: 200 },
{ name: 'Nissan', price: 400 },
{ name: 'Nissan', price: 600 },
];
const showString = (car) => `${car.name} is ${car.price * 200} rupies`;
const messages = cars.map((car) => showString(car));
console.log('🚀 ~ file: index.js ~ line 11 ~ messages ~ messages', messages);
@QuocCao-dev
Copy link

const cars = [
  { name: "Ford", price: 200 },
  { name: "Nissan", price: 400 },
  { name: "Nissan", price: 600 },
];

const showString = (car) => `${car.name} is ${car.price * 200} rupies`;

const messages = cars.map(showString);

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