What is the outcome of this statement, question that i got, and i got the answer but didn`t got the reason why

why The expression ‘hi!’.length will be evaluated to 3 and that will be printed to the console

What are you asking exactly?

hi
i have taken a test/quiz and one of the questions was what is the outcome of this statement console.log(‘hi!’.length)
and the answer was console.log(‘hi!’.length) will be evaluated to 3 and that will be printed to the console.
im asking why hi!.length is = 3, and that will be printed to the console.

"hi!.length is calling length on hi!. When you do that it finds out how many characters (in this case) there are.

1 Like

thank you! it helped me a lot have a great day

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