Solved grade challenge in JS