Mozilla Interview Question

Asked to code, and then iteratively, optimize a function.