FAQ: Introduction to JavaScript - String Concatenation

This community-built FAQ covers the “String Concatenation” exercise from the lesson "Introduction to JavaScript ".

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Introduction To JavaScript

FAQs on the exercise String Concatenation

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

6 posts were split to a new topic: Why doesn’t the text match the question?

3 posts were split to a new topic: Why would we use string concatenation?

2 posts were split to a new topic: Why would we use string concatenation?

6 posts were split to a new topic: Can a space be at the beginning or end of a string?

2 posts were merged into an existing topic: Why would we use string concatenation?

2 posts were merged into an existing topic: Why would we use string concatenation?

What does this mean?

Use string concatenation to concatenate a string with a space ' ' between the two other words: Use the + operator to join three separate strings:

console.log(‘string1’ + ’ ’ + ‘string2’)

I can’t get past this point. What do I do?

Consider,

console.log(‘Hello’ + ‘World’)

versus,

console.log(‘Hello’ + ’ ’ + ‘World’)

Now in a dynamic environment,

a = 'Hello'
b = 'World'
console.log(a + b)
console.log(a + ' ' + b)

Thank you for the reply. Should I be using a dynamic environment? How do i do that? I’m still not sure what the difference is between these except just being two different ways to write the same thing? How do i know when to use the right thing?

1 Like