Home › JavaScript Tutorial › Objects
Objects
Group related data under names.
An object holds key/value pairs. Read with obj.key, and keep lists of objects to model real data.
Example code
<pre id="o"></pre>
<script>
const user = { name: "Sam", langs: ["HTML", "CSS"], active: true };
user.langs.push("JS");
o.textContent = user.name + " knows " + user.langs.join(", ");
</script>