thecodezone.
The Code Zone
Short steps, at your pace · Free lessons and practice · Member video walkthroughs
Save your next small win.

Checking your account…

JavaScript freeCodeCamp companion

JavaScript / JavaScript / Variables and Strings

Build a Sentence MakerReuse a story frame with two sets of words.

Watch Rob build the project, understand what each part is for, then work through the official freeCodeCamp lab at your own pace.

9 requirements9:00 walkthroughBeginner · Lab · JavaScript

ORIGINAL WALKTHROUGH · 9:00

Watch with Rob.

Pause whenever you want to try a change. You can return to the lesson at any time.

LEARN WITH THE CODE ZONE

Unlock this video walkthrough

Written lessons and coding practice are free. Video walkthroughs are included with a paid Code Zone membership or an active free trial.

Have a Code Zone website account? Use your learning account’s email to get a six-digit sign-in code, or use your existing website password.

Need a website account? Paid Skool members and active trial members can use the email from their membership questions to request a sign-in code. No invite link or Skool password needed.

Close this window to keep practicing. After signing in, you’ll return to this lesson.

Video walkthroughs are included with an active Code Zone membership. The written lesson and practice are free.

Rob’s public YouTube walkthrough is paired with the current official exercise below. Use the current freeCodeCamp checks as the source of truth when a recording differs. This page uses the matching public channel walkthrough; the Skool classroom also contains a native recording, which may have a different edit or duration.

Finished this walkthrough?

Mark it complete to keep your place in The Code Zone. This does not submit or complete the official freeCodeCamp project.

Next: Build a Teacher Chatbot

THE IDEA BEHIND THE BUILD

What this lab teaches

Separate the words that change from the sentence frame that stays the same. Follow the program in execution order: identify its inputs, predict the next value and compare that prediction with the console output.

Use each explanation to understand the reasoning, then make your own changes in the official editor. The examples below use a separate workshop scenario rather than supplying the completed freeCodeCamp solution.

01

Prepare the story values

Declare words and the first story binding.

02

Assemble the first version

Build and print the first story.

03

Reuse the frame

Replace the words and create a second stored result.

Reuse a story frame with two sets of words.
Reuse a story frame with two sets of words.

REVIEW THE REQUIREMENTS · THREE CLEAR GOALS

Your route through the lab

These groups are a reading guide to the lab, rather than timestamped chapters of the video.

01Requirements 1–3

Prepare the story values

Declare words and the first story binding.

Check your understanding: Which of the six words needs let because it changes for the second story?

Explore requirement 1
02Requirements 4–5

Assemble the first version

Build and print the first story.

Check your understanding: Does every word appear in the required position with the right spaces?

Explore requirement 4
03Requirements 6–9

Reuse the frame

Replace the words and create a second stored result.

Check your understanding: Why does reassigning the words leave firstStory unchanged?

Explore requirement 6

SEE HOW THE PARTS FIT

How the program fits together

This independent example demonstrates one program pattern from the project. Predict its output before trying the related official requirement; it is not a finished lab solution.

example.jsjavascript · example
let studioName;
studioName = "River Studio";

Three things to pay attention to

An early saved story changes only in your imagination

The first assembled string stays fixed when its word bindings are later reassigned.

A new frame for the second story

Use the same required story frame with new words so the test compares the intended pattern.

Missing word replacements

Update all six word values before assembling the second story.

UNDERSTAND IT HERE · PRACTICE IT THERE

Explore each requirement

Choose a requirement for a plain-English explanation, a separate code example and resources to explore. When you are ready, its button opens the official freeCodeCamp lab. Your official tests and completion stay on freeCodeCamp.

Requirement 1Give a value a name

UNDERSTAND THE IDEA

A declaration introduces a binding that later statements can reference. Use let when the workshop will reassign that binding. Declaring a name and assigning its first value can happen separately or in one statement.

What you will do

Declare the six requested story-word bindings using let so you can change their values later.

A separate example to explore
step-1-example.jsjavascript · example
let studioName;
studioName = "River Studio";

What to notice: The declaration introduces the name; the assignment supplies its current value.

Resources to explore

Read another explanation or experiment with examples before trying the official lab.

Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.

Requirement 2Store the first text value

UNDERSTAND THE IDEA

The assignment operator takes the expression on its right and stores its value under the name on its left. Text needs quotation marks; otherwise JavaScript treats the word as a name to look up.

What you will do

Give each story-word binding a text value of your choice.

A separate example to explore
step-2-example.jsjavascript · example
let material;
material = "clay";

What to notice: The quotes identify text. The equals sign performs assignment, not comparison.

Resources to explore

Read another explanation or experiment with examples before trying the official lab.

Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.

Requirement 3Give a value a name

UNDERSTAND THE IDEA

A declaration introduces a binding that later statements can reference. Use let when the workshop will reassign that binding. Declaring a name and assigning its first value can happen separately or in one statement.

What you will do

Introduce firstStory to hold the assembled first version.

A separate example to explore
step-3-example.jsjavascript · example
let studioName;
studioName = "River Studio";

What to notice: The declaration introduces the name; the assignment supplies its current value.

Resources to explore

Read another explanation or experiment with examples before trying the official lab.

Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.

Requirement 4Build a message from stored values

UNDERSTAND THE IDEA

Concatenation joins text fragments into a new string. With strings, the plus operator joins rather than adds numbers. Spaces and punctuation must come from the literal fragments you supply.

What you will do

Build firstStory from the official story frame and the six stored word values, preserving the required spaces and punctuation.

A separate example to explore
step-4-example.jsjavascript · example
const material = "clay";
const note = "Bring " + material + ".";
console.log(note);

What to notice: The space after Bring and the final period are part of the literal text.

Resources to explore

Read another explanation or experiment with examples before trying the official lab.

Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.

Requirement 5Read a message in the console

UNDERSTAND THE IDEA

A console message is observable output from a running program. Quoted text is a literal; an unquoted variable name asks JavaScript to read the value stored under that name. Separate calls appear in execution order.

What you will do

Print the first-story label followed by the assembled firstStory value.

A separate example to explore
step-5-example.jsjavascript · example
const workshop = "Clay studio";
console.log(workshop);

What to notice: The console prints the value, rather than the variable name or its quotation marks.

Resources to explore

Read another explanation or experiment with examples before trying the official lab.

Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.

Requirement 6Change a binding for later statements

UNDERSTAND THE IDEA

Reassignment updates an existing let binding without redeclaring it. Statements that run afterward read the new value. A string assembled earlier is already a separate value and is not rebuilt automatically.

What you will do

Assign a new text value to each of the six existing word bindings.

A separate example to explore
step-6-example.jsjavascript · example
let material = "clay";
const oldLabel = "Bring " + material;
material = "paper";
console.log(oldLabel, material);

What to notice: The saved label still mentions clay while material now holds paper.

Resources to explore

Read another explanation or experiment with examples before trying the official lab.

Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.

Requirement 7Give a value a name

UNDERSTAND THE IDEA

A declaration introduces a binding that later statements can reference. Use let when the workshop will reassign that binding. Declaring a name and assigning its first value can happen separately or in one statement.

What you will do

Introduce secondStory as a separate stored result.

A separate example to explore
step-7-example.jsjavascript · example
let studioName;
studioName = "River Studio";

What to notice: The declaration introduces the name; the assignment supplies its current value.

Resources to explore

Read another explanation or experiment with examples before trying the official lab.

Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.

Requirement 8Build a message from stored values

UNDERSTAND THE IDEA

Concatenation joins text fragments into a new string. With strings, the plus operator joins rather than adds numbers. Spaces and punctuation must come from the literal fragments you supply.

What you will do

Assemble secondStory using the same story frame and the newly assigned words.

A separate example to explore
step-8-example.jsjavascript · example
const material = "clay";
const note = "Bring " + material + ".";
console.log(note);

What to notice: The space after Bring and the final period are part of the literal text.

Resources to explore

Read another explanation or experiment with examples before trying the official lab.

Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.

Requirement 9Read a message in the console

UNDERSTAND THE IDEA

A console message is observable output from a running program. Quoted text is a literal; an unquoted variable name asks JavaScript to read the value stored under that name. Separate calls appear in execution order.

What you will do

Print the second-story label followed by secondStory and compare it with the first version.

A separate example to explore
step-9-example.jsjavascript · example
const workshop = "Clay studio";
console.log(workshop);

What to notice: The console prints the value, rather than the variable name or its quotation marks.

Resources to explore

Read another explanation or experiment with examples before trying the official lab.

Ready to try it? Use freeCodeCamp’s exact requirements and run its checks there. The example above is for understanding the concept.

READY TO BUILD?

Keep the instructions beside the video.

Start the official lab in a new tab, play the walkthrough here, and pause to make each change yourself. Run freeCodeCamp’s checks before moving on. Write and check your project in the official freeCodeCamp editor.

An independent walkthrough by The Code Zone. Not affiliated with or endorsed by freeCodeCamp. The project and official tests belong to freeCodeCamp; the explanations and visual guide on this page are our companion material.