Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNicholas Wallen
12,278 PointsWhy use: console.log(this.sound);?
Not sure what the purpose of adding this was.
If you delete that line from the speak() method, it does the same thing.
3 Answers
Mostafa Mekawy
75 Pointssteven but what is the purpose of the method itself it doesn't make sense we still can use the sound in the constructor without any method
Steven Parker
231,184 PointsThe "console.log" is what causes the "sound" message to appear on the console.
If the message was shown after you deleted the line, you probably forgot to save your change in the editor (with the menu or Ctrl-S shortcut) before re-running the program.
syriaca
3,742 PointsMostafa Mekawy sound paramaters in the constructor is not directly related to the speak method... you could console.log any of the other parameters
Steven Parker
231,184 PointsSteven Parker
231,184 PointsThe main use of "console.log" is to track program progress during development. It's not generally used in final release code.