Walmart interview question

Write a polyfill for map and reduce