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 trialLokesh Sanapalli
1,242 PointsHow does showComments and isLiked working without any function
I don't understand in the click event of buttons he used isLiked = !isLiked
and showComments = !showComments
. I don't understand where does the functions lie for these to get called? how does this work?
2 Answers
Robin Pedersen
3,889 PointsI am not sure, but I think when "isLiked" is defined it is automatically false. And then when you click the button it says make "isLiked" the opposite of what it is (!isLiked) so "isLiked" become true. The CSS will generate when the "isLiked" is true. So if you push the button again it makes "isLiked" the opposite again, which is false and the CSS will be removed.
Andrew Chalkley
Treehouse Guest TeacherHey Ken Howard
Could you Lokesh would like some explainer on this? Could you write a few details on this?
Regards
Andrew
Sana Khateeb
3,979 PointsSana Khateeb
3,979 PointsI'm waiting for an answer on this too. I'm using IntelliJ to code this and it even says isLiked and showComments are unresolved variables but the code still works.