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


Cole Logan
Cole Logan
4,582 Points

Are the commas at the end of the application properties convention or something?

Application.propTypes = { title: React.PropTypes.string, };

the semicolon isn't required for the code to compile it will still work the same also the semicolon at the end of the propTypes object isn't required.

can someone confirm my knowledge

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi Cole Logan,

This practice isn't a convention but something a large portion of developers (including myself) do to overcome a common issue which is moving object properties around and not realising a line doesn't have a comma at the end. In a nutshell, having the trailing comma allows for easy movements of code without needing to think about missing commas which caused quite a bit of pain before IE9 rolled out to the world.

There is no requirement to follow this practice, but it is useful since browsers will compile the code just fine and it is even making an appearance in the next ECMAScript specification for function parameters which is a welcome site as adoption of this practice is becoming commonplace now.

Hope that helps.