I'm just a beginner,so regarding my solution to question 1,i've no idea whether it's correct or wrong,but hope any expert can correct and teach me(i just learn javascript last 2 weeks)