HackerRank Problem Solving TimeConversion using JavaScript