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

Contenido del Curso

Introduction to JavaScript

Introduction to JavaScript

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

bookChallenge: 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

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 10
some-alt