Answers for "what does .map in javascript means"

8

How does map works in javascript?

const products = [
    { name: 'Laptop', price: 32000, brand: 'Lenovo', color: 'Silver' },
    { name: 'Phone', price: 700, brand: 'Iphone', color: 'Golden' },
    { name: 'Watch', price: 3000, brand: 'Casio', color: 'Yellow' },
    { name: 'Aunglass', price: 300, brand: 'Ribon', color: 'Blue' },
    { name: 'Camera', price: 9000, brand: 'Lenovo', color: 'Gray' },
];

const productName = products.map(product => product.name);
console.log(productName);
//Expected output:[ 'Laptop', 'Phone', 'Watch', 'Aunglass', 'Camera' ]
Posted by: Guest on September-11-2021
4

javascript map

The map() method creates a new array with the results of calling a provided function on every element in the calling array.
Posted by: Guest on December-22-2019

Code answers related to "what does .map in javascript means"

Code answers related to "Javascript"

Browse Popular Code Answers by Language