Hi,
I’m struggling with map property, I mean I’m french, and the translation is obscure.
Someone can explain me with an example the meaning in English.
Thanks
It would really help if you could tell us what you understand and which parts confuse you. Array.prototype.map() allows you to provide a function that will transform every element into an array and replace it with the result of that function.
I understood the method and the way to use it, it’s Javascript functionnal.
But it’s more the English I don’t understand.
What’s mean map, I tought it was mean, an us map or Island map.
ex: " in JavaScript and allows you to “map” over an array"
Ah. I’m guessing that the origin of the name “map” comes from the fact the callback function creates what we would call “a one-to-one mapping of values,” meaning for every input there is exactly one predictable output. In the example used on MDN, they are creating squares. In that situation we would say that “two maps to four, three maps to nine,” and so on.
I can say, a map is a synonym to iterate?
It helps to understand even if it still obscure
@ArielLeslie
Mapping word still me…
EDIT: After reading again, I got it, thanks
Btw, I don’t think we have this expression in French?
I haven’t problem to understand the prototype it self, thanks anyway.
I think that’s a good description.
I would go just one step further by saying “iterate and change”… because that’s what you usually do with map
. You create a new array by iterating over each item and changing it to something new.
in French, I forgot about this feature