Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Sentence Building | Basic Operations
Introduction to JavaScript
course content

Course Content

Introduction to JavaScript

Introduction to JavaScript

1. Basic Concepts
2. Variables and Data Types
3. Basic Operations
4. Conditional Statements
5. Loops
6. Functions

book
Challenge: Sentence Building

Task

Let's build a full sentence using string concatenation.

  1. Create the string "I am hungry!" using the + operator.
  2. Add words with spaces (except the first one) using the += operator.
12345678
let sentence = ""; sentence += "___"; // "I" sentence += "___"; // "I am" sentence += "___"; // "I am hungry" sentence += "___"; // "I am hungry!" console.log(sentence);
copy

The output should be:

Add words with spaces (e.g., " am"" hungry").

12345678
let sentence = ""; sentence += "I"; // "I" sentence += " am"; // "I am" sentence += " hungry"; // "I am hungry" sentence += "!"; // "I am hungry!" console.log(sentence);
copy

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 10
We're sorry to hear that something went wrong. What happened?
some-alt