fixed the code to work in console.log