Do problem 1 in imperative JavaScript.