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

I do not know why this won't work. It is very easy to read and four line of code.

<script>
/*Why Nothing appears in my browser? I think I am allowed to
 use a method on a property because value.upperCase will work.*/
let num='34534234'
alert(num.length.JSON.parse('2'))
/*Why the second line of code works if the first line of code won't work?*/
h1.classList.add()

.
</script>

1 Answer

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

Hi there, msdsmd sm,dfsadf! It's a little hard to know what you're after here. However, you're trying to access the JSON object as if it were a property on the length property of a String object.

The parse method of the JSON object takes a string. You only need to do JSON.parse() and pass in a string :smiley:

I think what you're looking for is:

alert(JSON.parse(num));

Hope this helps! :sparkles: