Legnth property problems?

Greetings I am new to this coding app but I already love it I am having trouble doing the property legnth part of the basics and I have coded before but its only been block code and to solve my problem I’ve tried everthing I can think of to fix it but even the hint didn’t help.

Can I have a link to the lesson and the code you have.

I dont know how to give a link sorry.

Hello @sailormoonfan ,

Just include URL (https://www.codecademy.com) for the lesson you are having problems with.

This post will help you post your code too: [How to] Format code in posts - Getting Started - Codecademy Forums

And we will try to help you :slight_smile:

Thank you coffeencake! I will put the link in now


1 Like

Objects that can be iterated can also be indexed. Each countable element, whether a letter in a string object or element in an array has its own index. The total count of elements is stored in the object’s length property.

Object properties are accessed using dot notation.


Since length is a property of string and array objects, we can access the property of the object by using the object’s name (if a variable) and with dot notation, access the length.

str = "this is a string object"

console.log(str.length)    //  23

arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]

console.log(arr.length)    //  9

We can also access the property of a string or array literal.

console.log("this is a string object".length)    //  23

console.log([1, 2, 3, 4, 5, 6, 7, 8, 9].length)    //  9
1 Like

Ohhhh I get it now! Thanks for your help everyone! :slight_smile: