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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Ashi A](https://secure.gravatar.com/avatar/a1bafc3de04cbb00bc429abac5b9cb67?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ashi A
2,531 PointsNot sure why the Quiz marks this as incorrect (Properties Review Quiz in React)
Here's the quiz question to which the right answer that I typed in is " React.PropTypes.string "
function Player(props) {
// …
}
Player.propTypes = {
name: _________________
};
Unfortunately, this answer is marked as incorrect. And I'm not sure why. Is my syntax off? Or is there something else that I'm missing?
https://facebook.github.io/react/docs/typechecking-with-proptypes.html
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYou may have overlooked one of the requirements.
The question asks: "Fill in the code to ensure the property “name” is a required string for the Player Component:"
So the correct answer would be React.PropTypes.string.isRequired
![Sanjeev Veloo](https://uploads.teamtreehouse.com/production/profile-photos/7268772/micro_sanjeev-profile.jpg)
Sanjeev Veloo
4,713 PointsI had the same issue. What I did was I left out the comma at the end. But shouldn't the comma always be there?
I mean, in the video it's "React.PropTypes.string.isRequired,"
But when I used "React.PropTypes.string.isRequired" without the comma, it validated.
Weird!
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsA comma would be placed between items, but not after the last item.
![Henrik Boelsmand](https://secure.gravatar.com/avatar/6e3548412d80375df5c7692d96fe5680?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Henrik Boelsmand
11,395 PointsI was wondering about this as well and I suppose it should allow both with and without comma on the last item. It depends on which version of JS/ECMAScript you are writing: http://eslint.org/docs/rules/comma-dangle
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsSome versions might let you get away with some syntax errors. But it would be better to practice to write code that will run in all versions.
![Henrik Boelsmand](https://secure.gravatar.com/avatar/6e3548412d80375df5c7692d96fe5680?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Henrik Boelsmand
11,395 PointsTrailing commas in object literals are valid as per ECMAScript 5 and not a syntax error. Since the teacher uses them in the course it should be a valid answer for the quiz. However I get your point but that is a debate on when to adopt new features of the languages. In any case Babel would make it backwards compatible.
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsI understand that newer engines allow it, and in ES6 you can even do that with function parameters. But it blurs the distinction between separators and delimitiers, and I don't personally consider it to be a good practice. It doesn't allow your code to do anything it wouldn't do the other way, so why break back-compatibility unnecessarily?
Ashi A
2,531 PointsAshi A
2,531 Points:facepalm: Doh!
Thank you, Steven.