Commutatus Interview Question

Write a polyfill for Array flat().