Learn JavaScript: Objects
Expand your programming knowledge with objects!
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).
Objects
Lesson 1 of 1
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory