freeCodeCamp/guide/english/certifications/javascript-algorithms-and-d.../basic-javascript/build-javascript-objects/index.md

20 lines
628 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Build JavaScript Objects
---
# Build JavaScript Objects
Objects are similar to arrays, except that instead of using indexes to access and modify their data, you access the data in objects through what are called properties.
Here's a sample object:
var cat = {
"name": "Whiskers",
"legs": 4,
"tails": 1,
"enemies": ["Water", "Dogs"]
};
Objects are useful for storing data in a structured way, and can represents real world objects, like a cats.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->