removed unnessary code
first problem soved, reduce function and mapping)
fixed syntax
solved question 4, learnt indexOf
learned map function