help me with my assignment
robertarroyo87 (0)

Can someone help me with my assignment? Im new at coding. I Need help with question 3. I have tried everything and every video. I just can't figure it out.

You are viewing a single comment. View All
mwilki7 (382)

@robertarroyo87
Strings in JavaScript have a property called "length" obviously to tell you how long a word is.

The videos you've seen have probably told you this already but,
to access a property of an object attach a period . at the end of the variable name, followed by the name of the property.

In your case you want to .length from str

str.length

You also have a variable called length (a valid name, but it's confusing to use "length" so many times for different things)
var length;
You just want to set length equal to str.length like so:

var length;
length = str.length;