My P2 JS challenge code for nano degree