Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const items=[
- { name:'Bike' , price:100} ,
- { name:'TV' , price:200} ,
- { name:'Album' , price:10} ,
- { name:'Book' , price:5} ,
- { name:'Phone' , price:500} ,
- { name:'Computer' , price:1000} ,
- { name:'Keyboard' , price:25}
- ]
- //map allows you to take an array and convert it to a new array and return something specific if u want
- const itemNames=items.map((items)=>{
- return items.name;
- })
- console.log(itemNames);
- const itemPrices=items.map((items)=>{
- return items.price;
- })
- console.log(itemPrices);
Add Comment
Please, Sign In to add comment