Strrrrrrring Interpolation!--A New Tiny Annoying Problem


#1

Hello Coders!

I have another small, annoying, and laughable problem. Below is the link to the place of my annoyance:

https://www.codecademy.com/courses/learn-javascript-introduction/lessons/variables/exercises/string-interpolation?action=lesson_resume&course_redirect=introduction-to-javascript

(@hampusscandgate, I trust that there is not a typo in the link :grin:)

I am concerned with the second problem –

Use console.log to print: ‘My favorite animal: Koala’, but replace ‘Koala’ with your favoriteAnimal variable.

(My favorite animal is the robin, but that doesn’t matter.) Now, how do I replace a word? do I type in


>let favoriteAnimal = 'robin';
**console.log('My favorite animal is a Koala' - 'Koala'+ favoriteAnimal)

?

Please help, anyone! I eagerly await your replies!

@elfmaidenofdoriath


#2

To modify strings when they’re being logged to the console, you wouldn’t subtract the specific word.

The example the exercise gives is
var myPet = "armadillo"
console.log('I own a pet ’ + myPet + ‘.’);

To solve it, you’d do something like

console.log("My favorite animal: " + favoriteAnimal + '.');

#3

Oooh. So I wasn’t supposed to type in Koala! Thanks for the help!


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.