Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Wendy Anderson-Burton
Wendy Anderson-Burton
948 Points

error does not make sense

THIS IS THE CODE const name = "Andrew"; const details = { favouriteLanguage: "JavaScript", age: 33, children: 3 } const errorMessage = "Something bad has occurred"; console.log(name); console.dir(details); I needed to console the error message THIS IS WHAT I TYPED AFTER THE last line. console.err(errorMessage); Why is this wrong?

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

4 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! I received your request for assistance. When you try and run this code in the challenge you will receive a "console err is not a function". This is because err is not a valid console function. However, error is. If I change your last line to:

console.error(errorMessage);

Your code passes! Here is the MDN documentation that shows all valid functions on the Console object.

Hope this helps! :sparkles:

Try this:

console.error(errorMessage);
Adam Beer
Adam Beer
11,313 Points

Hi! Just a typo. console.err is not a function. Please change to console.error.

Wendy Anderson-Burton
Wendy Anderson-Burton
948 Points

Thank you all I will go back and try that.