Object Property in JavaScript

Level 251 keystrokes

This creates an object with a name property and outputs 'Bob'.

JavaScript code

// Objects are created with curly braces {}
// Properties are key: value pairs
1let user = { name: "Bob" };
// Access properties with dot notation: object.property
// user.name gets the value of the name property
2console.log(user.name);

Output

Bob
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this JavaScript code and how often they appear.

  • ;× 2
  • .× 2
  • "× 2
  • :× 1
  • (× 1
  • )× 1
  • {× 1
  • }× 1
  • =× 1

More JavaScript examples at level 2

← JavaScript typing practice