I’m confused about the syntax of objects shown on this page; in the first example, the syntax is shown as the properties having an ending semi-colon, but the block not having one. In the second example, the properties block has an ending semi-colon, but the list of properties within it doesn’t. I’m sure the second example is correct but what about the first? Is this a typo or have I misunderstood something?
The example I’m referring to:
const exampleObject = {
propertyName: value;
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15
Challenge Information:
Introduction to JavaScript Objects and Their Properties - What Is an Object in JavaScript, and How Can You Access Properties from an Object?
You are right. The first example produces a syntax error with that semi-colon. I would also suggest that “value” should be in square brackets as that would produce an error unless “value” was defined as a variable?
Will you be able to report these errors on Github?
Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.