← Back to Examples
JavaScript Objects Demo
Try Object Operations
Click a button to see examples...
Code Examples
Creating Objects
const person = {
name: 'Alice',
age: 25,
greet() {
return `Hi, I'm ${this.name}`;
}
};
Accessing Properties
// Dot notation
person.name // 'Alice'
// Bracket notation (for dynamic keys)
const key = 'age';
person[key] // 25
// Check if property exists
'name' in person // true
← Back to Examples