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 (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" :)