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

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,314 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.