I am going over JavaSpript course.
In the screenshot I have shown what I have done and what are the printed values.
I do not understand where does the undefined come from. When I console log beep for tinCan it prints ‘Beep Boop’ as expected, however I get this second undefined line which I do not where it comes from?
the undefined comes from line 13, the
.beep method does not return anything, so attempting to log the result of calling this method will give undefined
you could either:
- make beep return the string
- don’t log the returned result of calling beep method
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.