Added JS version of Exercise 3 and 4