1stDibs.com Interview Question

Recursively flatten a nested hash in JavaScript. Explain the difference between classical and prototypal inheritance. Code runtime optimization