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 (2014) Building a Command Line Application Using try and catch

Missing a variable declaration in my try block?

I'm struggling with this one, when I run the code I'm getting an error that I'm missing my variable declaration in my try block. I'm new to this so I'm sure it's a simple oversight but I've put a half and hour in trying to figure it out to no avail. Help!!

app.js
var jsonString = 'This is not a JSON String';
try {
    var jasonObject = JSON.parse(jsonString);
} catch (error){
    console.log(error.message);
};

1 Answer

Hi Erik,

This was tricky. Your variable inside the try block is spelled jasonObject and needs to be jsonObject

ugh I've done this like 12 times but didn't catch it this time around.

thanks!

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Erik Sayce - A second pair of eyes always help.

Jason Seifer and I have a long running joke of saying "JSON not Jason" or was it "Jason not JSON" :)