Properties


#1

I’m doing the Intro to JavaScript exercise number 5 on properties. While i was able to get the code right, i want to understand the purpose of writing the code:
console.log(“Teaching the world how to code”.length)
to print 30 on the console. What purpose would that serve?

Thanks!


#2

not much it seems, but sometimes the exercise just teach a concept. .length can be very useful when prompting the user for input, to verify they actually entered something (check if length is greater then zero)


#3

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