Updated js of Question 1 (2)