Add js for problem 6