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

Bruno Antonellini
Bruno Antonellini
4,911 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
4,911 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,090 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.