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

Monica Messaggi Kaya
Monica Messaggi Kaya
4,271 Points

The error message is not relevant to the variables and what is asked on the exercise.

Challenge task 2 says: Review the code in app.js. Use the appropriate console method to print out the details object.

I changed the app.js to match the request, the code is below:

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

After checking work I've got the following error:

Bummer: You didn't write dir method on the console object anywhere in your code.

Which is possibly outdated as doesn't match the "details" variable, still showing "dir" according to the lesson video example. Cannot move forward now.

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

2 Answers

Rogier Nitschelm
seal-mask
.a{fill-rule:evenodd;}techdegree
Rogier Nitschelm
iOS Development Techdegree Student 5,461 Points

You didn't write dir method on the console object anywhere in your code.

I think they want you to use the console.dirmethod, instead of console.log. Remember there are quite some methods on the console-object like console.warning("I am a warning") and console.error("I am an error").

In this case I think they want you to use console.dir which prints the details of the object you pass to it.

https://developer.mozilla.org/en-US/docs/Web/API/Console/dir