this makes the string be “This dog has+ 4 legs”, isn’t there an extra character?
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Hi
you use the arrow function and it’s ok. But after that, you use Template literals instead of that, you can do this:
saylegs: ()=>{ return `This dog has `+ dog.numLegs+` legs.`}
The thing above is a concatenation.
Don’t forget some items:
function needs open&close curly braces.
use return keyword for output.
3.in concatenation don’t forget the space before or after the strings.
4.in objects try to use inside methods instead of template strings ${}
numLegs is an undeclared variable, notice how in the example it uses duck.name
You are asked to return This dog has 4 legs., you are also missing a character at the end of the string to be able to return the required output, other than having an extra character in the middle of it.
Changing those three things your code passes. You can solve this with arrow function implicit return and template literals.