Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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,650 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.