W3 Engineers interview question

How map() function works in JS?