I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
So do I need to add var in front of lastname? I think I am likely missing a small thing like a period or quotations or something in the wrong place, but I can’t seem to find it. Can you please see what I did and help?
The string “Lovelace” has been assigned to the variable lastName. Another way to think of it is if we place “Lovelace” inside a box called var lastName.
So how can we use just the variable name (which holds the contents of “Lovelace”) and the length property in our answer.
We can also refer back to the FCC example too if that helps.
For example, if we created a variable var firstName = "Charles" , we could find out how long the string "Charles" is by using the firstName.length property.
I appreciate the visual and those are the exact examples I’ve been looking for a couple hours now (usually takes me about five minutes) so of course I am starting to get frustrated as I can’t see what I am missing.
To answer you example above I would type:
lastName = “Lovelace”
is that it? Or
lastName = “Lovelace”;
or maybe neither?
I’m pretty sure I’ve typed lastName.length and I am missing something like do I need var or quotes or equal sign? I really have tried every combination and searched the internet and there is no example that is turning my light bulb on unfortunately.
Can you show me the Charles example as you would exactly type it out to find the length? The way they do it hasn’t worked for me. Thanks for your help.