002 solution in js