Objects
Learn about JavaScript ES6 object syntax to model real-world items.
StartKey Concepts
Review core concepts you need to learn to master this subject
Restrictions in Naming Properties
Dot Notation for Accessing Object Properties
Objects
Accessing non-existent JavaScript properties
JavaScript Objects are Mutable
JavaScript for...in
loop
Properties and values of a JavaScript object
Delete operator
Restrictions in Naming Properties
Restrictions in Naming Properties
// Example of invalid key names
const trainSchedule = {
platform num: 10, // Invalid because of the space between words.
40 - 10 + 2: 30, // Expressions cannot be keys.
+compartment: 'C' // The use of a + sign is invalid unless it is enclosed in quotations.
}
JavaScript object key names must adhere to some restrictions to be valid. Key names must either be strings or valid identifier or variable names (i.e. special characters such as -
are not allowed in key names that are not strings).
What you'll create
Portfolio projects that showcase your new skills
Meal Maker
It's time to build fluency in JavaScript objects. In this next Pro Project, we're going to practice getters and setters in JavaScript so you can hone your skills and feel confident taking them to the real world. Why? Getters and setters allow you to easily insert and retrieve data out of an object. What's next? Eating out, a three course meal, more JavaScript. You got this!
Team Stats
It's time to build fluency in JavaScript Data Structures. In this next Pro Project, we're going to practice Objects in JavaScript so you can hone your skills and feel confident taking them to the real world. Why? Objects are a very important data structure in JavaScript. What's next? Sports stats, data manipulation, more JavaScript. You got this!
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory