finished problem 1 in js
problem 2 solved