Added JavaScript solution for problem 1