Properties lesson


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

i really cant understand that…


#2

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


#3

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

What’s the matter?


#4

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?


#5

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


#6

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?


#7

i think i have a mental bug…


#8

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


#9

Take my retirement while I have time, thank you.


#10

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