Check out a free preview of the full Introduction to JavaScript course:
The "Looping Exercise" Lesson is part of the full, Introduction to JavaScript course featured in this preview video. Here's what you'd learn in this lesson's course:

Students are instructed to to write a loop that prints a concatenated string to the console.

Get Unlimited Access Now

Transcript from the "Looping Exercise" Lesson

>> Brian Holt: So I have a little exercise for you. Let's go back to our browser here, and we're going to go to frontendmasters.github/io/bootcamp.
>> Brian Holt: Come back to the Boot Camp site. Come down to Programming Fundamentals.
>> Brian Holt: And we're gonna do a little CodePen here.
>> Brian Holt: So I'm gonna click here, Edit on CodePen to open this in CodePen.

>> Brian Holt: So what I want you to do, I want you to combine two of the things that we've talked about so far, which is string concatenation.
>> Brian Holt: And I want you to do a loop and you can do either a while loop or a for loop.
>> Brian Holt: So basically the idea is you're gonna have some character here, so you can have const character = f or something that.

>> Brian Holt: This is probably the smallest. Let's make that a lot bigger.
>> Brian Holt: And const timesToRepeat. Go with something like 5. And then I want you to write a for loop here or a while loop here that will take this character and add itself to itself that many times.

So that I end up with a string like f, f, f, f, f five times. So that whenever I say, let myString or something like that,
>> Brian Holt: This is called an empty string right here which you probably will need. An empty string is a string with no characters in it, right?

So it's not undefined, it is a string, the string just has nothing in it.
>> Brian Holt: You're gonna put your code here.
>> Brian Holt: Some sort of loop.
>> Brian Holt: I don't care. And then, at the end, I want you to be able to console.log(myString) here. And that will log out f, f, f, f.

>> Brian Holt: Or let's do t, or something like that.
>> Brian Holt: Makes sense, yeah.
>> Speaker 2: I was just wondering. Earlier, you pointed out that when it's a constant you use a different way of labeling, like all capitals? And here you're not doing that, so is it not used that much in the real world?

>> Brian Holt: Yeah, it would be more things that are like fixed in the physical world, like months in a year. That's never gonna change, right? It's more, or like the, I don't know, days in a month or something like that. Not necessarily something like a variable here, right. So I wouldn't make this in screaming case, right.

That's why it's called screaming case. Does that make sense?
>> Speaker 2: Because it could be a, or b, or c?
>> Brian Holt: Yeah, and it could change at a later date, right? Months and years, never gonna change.