W3 Engineers Interview Question

How map() function works in JS?