Uber interview question

Create custom reduce and map function in javascript.