-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmore-map.js
More file actions
19 lines (18 loc) Β· 772 Bytes
/
more-map.js
File metadata and controls
19 lines (18 loc) Β· 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Hazrat Ali
// University Of Scholars
const friends = ['Tom Hanks', 'Tom Cruise', 'Tom Brady', 'Tom Solaiman'];
const fLengths = friends.map(friend => friend.length);
// console.log(fLengths);
// more map js
const products = [
{ name: 'water bottle', price: 50, color: 'yellow' },
{ name: 'mobile phone', price: 15000, color: 'black' },
{ name: 'smart watch', price: 3000, color: 'black' },
{ name: 'sticky note', price: 30, color: 'pink' },
{ name: 'water glass', price: 3, color: 'white' }
];
const productNames = products.map(product => product.name);
const productPrices = products.map(product => product.price);
// products.map(product => console.log(product));
products.forEach(product => console.log(product));
// console.log(productPrices);