Exercise 10 Q


#1


How's it going, guys? I wanna use this opportunity to both introduce myself and ask a question. You guys can call me LCan. I'm looking forward to learning from everybody here.


https://www.codecademy.com/en/courses/getting-started-v2/1/5?curriculum_id=506324b3a7dffd00020bf661#


I'm trying to figure out the string length of something containing parenthesis. Is it possible?


confirm("ready to go?") 
"confirm("ready to go?")".length


#2

Hi Lcan! Good to meet you.

In order to not overcomplicate things, the short answer is no. You'll see why when you get to the chapter about functions and later on methods. Don't worry about it too much yet and just go with the lessons.

Good luck!


#3

Do you mean parenthesis or do you mean quotation marks?

If you do it this way:

"confirm('ready to go?')".length

You will get the answer 23, which is the number of characters inside the " ".

If you are expecting the confirm() function to still work, it will not. Anything inside quotation marks will be considered a string.


#4

I was trying to have the confirm function work and figure out how many characters were used in order to create that whole function. To clarify, is it possible?

I learned about // to make comments a few exercises ago; is there a way to make the computer ignore certain characters like it does to text?


#5

If you mean, "How many characters were returned by the confirm function", then you can not do it by putting everything in quotation marks like that. Anything in quotation marks will be treated as a string, the confirm function will not work inside quotation marks.


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.