finished exercises 9 and 10 javascript