Properties lesson

// have 5 characters? 4+1 null?
console.log("Teaching the world how to code".length);
// 25 + 5 spaces = 30...not 31?
// has only 25!!

i really cant understand that…

length starts counting at 1, so hello just has a length of 5. not sure what 4+1 null? means

1 Like

Hello has 5
Teaching the world how to code has 30
Teachingtheworldhowtocode has 25

What’s the matter?

hello have 4 characters no space bar
Teaching the world how to code have 30 with space bar
Teachingtheworldhowtocode have 25 space bar
…How is it counting 5 characters?

if hello use 5…
Teaching the world how to code use 31 or Teachingtheworldhowtocode 26 but it does not occur.

h = 1
e = 2
l = 3
l = 4
o =5

i count 5, as i demonstrated above. Not sure how you get to 4

i count 30 characters in Teaching the world how to code, how would you get to 31?

1 Like

i think i have a mental bug…

Could be, i am a struggling to see where you go wrong.

Take my retirement while I have time, thank you.

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