Changed document.write to console.log per instructions.