0

Complete the function 'interpolate'. This function will take in a string parameter, and return a string

I have put string data into the console log and called the function

I was expecting for the string of "I love lettuce"

function interpolate(favoriteFood) {
  console.log("I love" + favoriteFood);
}
interpolate("lettuce");
Paul Floyd
  • 5,530
  • 5
  • 29
  • 43
Codekw
  • 17
  • 6
  • 1
    And what went wrong? What are you stuck with? There's no actual question here. – phuzi Aug 13 '19 at 13:45
  • 1
    This isn't interpolation. –  Aug 13 '19 at 13:45
  • 1
    And add a space here `"I love "` `console.log(\`I love ${favoriteFood}\`);` – mplungjan Aug 13 '19 at 13:45
  • Im on galvanize.com question 18 Im not sure if you could get to it but I keep getting back an error I dont know how they want it done becuase when I put it in the browser console it comes back correct – Codekw Aug 13 '19 at 14:03
  • https://learn-2.galvanize.com/cohorts/888/blocks/215/content_files/placement_challenge.md – Codekw Aug 13 '19 at 14:03
  • @Codekw The question says you're supposed to return a string from the function. Your function doesn't return anything. –  Aug 13 '19 at 16:55
  • @Amy I put the console.log to print "I love lettuce" it doesnt I even wanted to use return keyword. The issue with this assignment is that another console is reading it one part of a program I am taking and it is not giving me feedback positve feedback. When I print any of the console.log or return in my browser console it prints but not on the assignmnet webpage – Codekw Aug 13 '19 at 18:01
  • You should *only* write to the console for *diagnostic* purposes. Writing to the console is not returning anything. `console.log` doesn't have a return value, either. –  Aug 13 '19 at 18:02

1 Answers1

0

look here for more information about string interpolation

this should do the trick:

console.log(`I love ${favoriteFood}`);

Synoon
  • 2,297
  • 4
  • 22
  • 37
  • Im on galvanize.com question 18 Im not sure if you could get to it but I keep getting back an error I dont know how they want it done becuase when I put it in the browser console it comes back correct – Codekw Aug 13 '19 at 14:03
  • https://learn-2.galvanize.com/cohorts/888/blocks/215/content_files/placement_challenge.md – Codekw Aug 13 '19 at 14:03