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 trialLaKhyia Lee
898 PointshandleSetRating parameter
Why did he add ( i + 1 ) ?
2 Answers
Zimri Leijen
11,835 PointsYou have 5 stars next to each other, and they're 0-indexed, so if you click the first star, with index 0, you want to give a rating of 1, etc.
So the index of the star + 1 is the rating.
LaKhyia Lee
898 PointsThank you!