Update problem.md

Moved the console.log line after the function as in the proposed solution.