Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,003 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);