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>
Roscoe Coney
Roscoe Coney
13,124 Points

looking at this quickly what happens when you add... right before </script>

console.log("this is my H1" + h1)

1 Answer

Hi, there, first of all JSON.parse() method is going to convert JSON data into a javaScript object, in this case, variable num is a not JSON data. so it will not going to return anything

secondly, length property is going to return the number of character, in this case is number 8. number is not a JSON data JSON.parse will not going to return anything either.