Altimetrik interview question

Write logic to implement Java Script Array map method.