0

I am learning JS , and i am trying to do this :

define a function named eat that takes an argument named food that is expected to be a string.

Inside the function return the food argument like this:

 return food + ' tasted really good.';

Inside of the parentheses of console.log(), call the eat() function with the string bananas as the argument.

Here is my code :

function eat(food) {
  return food + 'tasted really good.';
}
console.log(eat('bannanas'));

Thing is that i get 'bannanas' to concatenate with other text (bannanastasted really good.), can someone tell me where I am making a mistake . Thank you. :)

1
  • When you ask a question, please tell us: 1. What happened 2. What should have happened 3. What you want to happen 4. (optional) Your opinion on why is happened Commented Feb 19, 2017 at 1:25

1 Answer 1

5

You missed a space

function eat(food) {
  return food + ' tasted really good.';
}
console.log(eat('bannanas'));
Sign up to request clarification or add additional context in comments.

1 Comment

Oh wow, thank you! I really didn't knew that space is required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.