HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to JavaScriptVariables (let / const)Data TypesOperatorsStringsArraysObjectsConditions (if / else)Loops (for / while)FunctionsArrow Functions (=>)Array Methods (map / filter / reduce)
REFERENCE
📖 Overview
🖥️ Output & Console
📦 Variables
🔢 Numbers & Math
✍️ String
📋 Array
🗂️ Object
object {}Object.keys() / values() / entries()
🔁 Condition & Loop
🧩 Function
🔄 Type & Conversion
JavaScript›REFERENCE›Object
🗂️

Object

Data structured with key-value pairs.

CommandDescription
object {}Stores key-value pairs.
Object.keys() / values() / entries()Returns keys, values, or pairs as arrays.

object {}

Try it yourself →

Stores key-value pairs.

Syntax

const name = { key: value }

Description

Objects are created using curly braces. Values are accessed with dot notation (object.key) or square brackets (object['key']).

Returns

Object.

Example

const person = { name: "Alex", age: 36 };
console.log(person.name);
person.city = "London";
console.log(person);

Expected output

Alex
{ name: 'Alex', age: 36, city: 'London' }

When to use?

Storing entity properties (user, product); JSON data.

Object.keys() / values() / entries()

Try it yourself →

Returns keys, values, or pairs as arrays.

Syntax

Object.keys(object) · Object.values(object)

Description

keys provides the array of keys, values provides the array of values, entries provides [key, value] pairs.

Example

const k = { a: 1, b: 2 };
console.log(Object.keys(k));
console.log(Object.values(k));

Expected output

[ 'a', 'b' ]
[ 1, 2 ]

When to use?

Iterating through all fields of an object with a loop.

HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code