Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Node.js Basics 2017 Introduction to Node.js The Console

Bruno Antonellini
Bruno Antonellini
7,168 Points

I receive an error saying I didn't write "console" anywhere on the script

Use the appropiate to print an object to the console

console.dir(details);

app.js
const name = "Andrew";
const details = { favouriteLanguage: "JavaScript", age: 33, children: 3 } 
const errorMessage = "Something bad has occurred";
console.dir(details);
Bruno Antonellini
Bruno Antonellini
7,168 Points

Solved! Saw another question where the same happened, and I found out I shouldn't have erased the "console.log" from the previous step.

So keep both lines:

console.log(name);
console.dir(details);```

1 Answer

Robbie Thomas
Robbie Thomas
31,093 Points

const name = "Andrew"; console.log(name); const details = { favouriteLanguage: "JavaScript", age: 33, children: 3 } const errorMessage = "Something bad has occurred";

add: console.log(name); on line 2.