Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables Combining Strings

Jackie Irons
Jackie Irons
1,648 Points

Why do you need periods in the strings?

Why are there periods ". Welcome to Treehouse." ". Please come agian, when you want to learn some more. " before welcome and please?

2 Answers

Dane Parchment
MOD
Dane Parchment
Treehouse Moderator 11,077 Points

You are thinking to hard about those periods. These periods are being used within a string, that is within the double/single quotes: "." or '.' so basically those periods, are literally being used as periods in normal grammar. To end a complete thought, not any programming jargon.

Because he is concatenating strings together he decided to add the periods in the other parts of the string.

Why are there periods ". Welcome to Treehouse." ". Please come agian, when you want to learn some more. " before welcome and please?

because those are not numbers, because you have to put periods to tell javascript that whatever is in the periods are strings, meanings strings can only take words no numbers.

by the way, you can convert numbers to strings. and you can check if it is a string or what ...

ex

var myName = 'Hello my name is javascript'; console.log(typeof myName);