Pergunta de entrevista da empresa Apple

Write an array map function in Ruby and again in Javascript.