Fidelity Investments interview question

I was supposed to write few small JavaScript programs using JSFiddle