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 JavaScript Foundations Strings Methods

Gabi Udrescu
Gabi Udrescu
11,539 Points

Cannot pass through a basic codechallenge

I'm almost ready to finish the PHP Development track, but I bumped into a problem with a challenge from Javascript basics.

It asks me to see what's the length of a javascript string variabile, but if I use the exact method mentioned in the video course it returns an error.

The request is:

Challenge task 1 of 6
Update the variable of 'quickLength' on line 18, to assign the length of the string 'quick'.

The error is:

Bummer! You're missing .length

The code is:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title> JavaScript Foundations: Strings</title>
    <style>
      html {
        background: #FAFAFA;
        font-family: sans-serif;
      }
    </style>
  </head>
  <body>
    <h1>JavaScript Foundations</h1>
    <h2>Strings: Methods</h2>
    <script>
      var quick = "The quick brown fox jumps over the lazy dog";

          var quickLength    = quick.lenght;
          var indexOfBrown = quick;
          var tenthCharacter = quick;
          var wordBrown = quick;
          var quickUpper = quick;
          var quickLower = quick;
    </script>
  </body>
</html>

Any help would be much appreciated if I'm missing something.

4 Answers

Stacy Fabian
Stacy Fabian
2,246 Points

From here it looks like your length is spelled wrong. "lenght"

Gabi Udrescu
Gabi Udrescu
11,539 Points

yeah, you're right... once again, lesson learned the hard-way: never take code challenges in the middle of the night... (I'm on +3 GMT timezone and it's almost 2 AM here)..

Stacy Fabian
Stacy Fabian
2,246 Points

No worries. We all do it. :)

Stacy Fabian
Stacy Fabian
2,246 Points

No worries. We all do it. :)