A JavaScript object is a fundamental data structure used to store collections of key-value pairs, where keys are strings (or Symbols) and values can be any data type, including functions known as methods. These objects act as containers that group related properties (data) and actions together, allowing developers to represent real-world entities like users, cars, or courses in a structured way.

Creation and Structure Objects are most commonly created using object literal syntax with curly braces {}, though they can also be instantiated via the Object() constructor, Object.create(), or constructor functions.

  • Properties store data (e.g., name: "John"), while methods are functions that perform actions (e.g., greet: function() {...}).

  • Objects are mutable, meaning you can add, change, or delete properties after creation.

  • They support nested structures, allowing objects to contain other objects as values.

Access and Manipulation You can interact with object data using dot notation (e.g., object.property) for simple keys or bracket notation (e.g., object["key"]) for dynamic names, spaces, or special characters.

  • To iterate over an object, use loops like for...in, or utility methods such as Object.keys(), Object.values(), and Object.entries().

  • Nearly all objects inherit properties and methods from Object.prototype, though null-prototype objects (created via Object.create(null)) can be used to avoid inherited properties and prevent prototype pollution.

🌐
Zeeshan Ali
zeeshan.p2pclouds.net › home
What are Objects in JavaScript? Complete Beginner's Guide with Examples 2025 | Zeeshan Ali Blog
September 21, 2025 - Objects are the key building blocks of javascript and data structures. It stores date in key-value pairs. An object is a collection of properties, and a property is an association between a name (or key) and a value.
🌐
Ronald James
ronaldjamesgroup.com › article › get-a-brief-understanding-aboutjavascript-objects
Get a brief understanding about JavaScript Objects | Ronald James
In this post I have tried to create ... read further. So, let’s start at the beginning. A JavaScript object is just a collection of properties, each property is a pair of a key and a value....
People also ask

How do you create a JavaScript object?
Create a JavaScript object using curly braces {} with key-value pairs separated by commas: let person = { name: 'Alice', age: 30, city: 'New York' }. This creates an object with three properties.
🌐
zeeshan.p2pclouds.net
zeeshan.p2pclouds.net › home
What are Objects in JavaScript? Complete Beginner's Guide with ...
How do you create an object in JavaScript?
You can create objects using object literal syntax (const obj = {}), the new Object() constructor, Object.create(), or constructor functions/classes. Object literal syntax is the most common and concise method.
🌐
playcode.io
playcode.io › javascript › object
JavaScript Objects: Complete Guide to Creating & Using Objects ...
What does 'this' mean in JavaScript objects?
In JavaScript objects, 'this' refers to the object itself. When you use this.name inside an object's method, it means 'this object's name property'. It's like the object talking about itself.
🌐
zeeshan.p2pclouds.net
zeeshan.p2pclouds.net › home
What are Objects in JavaScript? Complete Beginner's Guide with ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Object › Object
Object() constructor - JavaScript | MDN
July 10, 2025 - The Object() constructor turns the input into an object. Its behavior depends on the input's type.
🌐
Playcode
playcode.io › javascript › object
JavaScript Objects: Complete Guide to Creating & Using Objects | Playcode
Master JavaScript objects: learn to create, access, and manipulate objects. Understand properties, methods, object literals, destructuring, and common object operations.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › objects: the basics
Object methods, "this"
If you come from another programming language, then you are probably used to the idea of a “bound this”, where methods defined in an object always have this referencing that object. In JavaScript this is “free”, its value is evaluated at call-time and does not depend on where the method ...
Find elsewhere
🌐
DEV Community
dev.to › scorcism › objects-in-js-complete-guide-3gl8
JavaScript Objects | Complete Guide - DEV Community
May 14, 2024 - Similar to other programming languages javascript objects is a collection of key-value pairs, where each key is a string and each value can be of any data type.
🌐
Mimo
mimo.org › glossary › javascript › object
JavaScript Object: Syntax, Usage, and Examples
The JavaScript object is one of the most fundamental elements in the language. Objects allow you to store collections of key-value pairs and represent real-world entities in a flexible and dynamic way.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects
Standard built-in objects - JavaScript | MDN
This chapter documents all of JavaScript's standard, built-in objects, including their methods and properties.
🌐
W3Schools
www-db.deis.unibo.it › courses › TW › DOCS › w3schools › js › js_object_definition.asp.html
JavaScript Objects
Strings can be objects (or primitive data treated as objects) ... In JavaScript, all values, except primitive values, are objects.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Object
Object - JavaScript | MDN
The Object type represents one of JavaScript's data types. It is used to store various keyed collections and more complex entities. Objects can be created using the Object() constructor or the object initializer / literal syntax.
Top answer
1 of 11
391

You can use Object.getOwnPropertyNames() to get all properties that belong to an object, whether enumerable or not. For example:

console.log(Object.getOwnPropertyNames(Math));
//-> ["E", "LN10", "LN2", "LOG2E", "LOG10E", "PI", ...etc ]

You can then use filter() to obtain only the methods:

console.log(Object.getOwnPropertyNames(Math).filter(function (p) {
    return typeof Math[p] === 'function';
}));
//-> ["random", "abs", "acos", "asin", "atan", "ceil", "cos", "exp", ...etc ]

In ES3 browsers (IE 8 and lower), the properties of built-in objects aren't enumerable. Objects like window and document aren't built-in, they're defined by the browser and most likely enumerable by design.

From ECMA-262 Edition 3:

Global Object
There is a unique global object (15.1), which is created before control enters any execution context. Initially the global object has the following properties:

• Built-in objects such as Math, String, Date, parseInt, etc. These have attributes { DontEnum }.
• Additional host defined properties. This may include a property whose value is the global object itself; for example, in the HTML document object model the window property of the global object is the global object itself.

As control enters execution contexts, and as ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be changed.

I should point out that this means those objects aren't enumerable properties of the Global object. If you look through the rest of the specification document, you will see most of the built-in properties and methods of these objects have the { DontEnum } attribute set on them.


Update: a fellow SO user, CMS, brought an IE bug regarding { DontEnum } to my attention.

Instead of checking the DontEnum attribute, [Microsoft] JScript will skip over any property in any object where there is a same-named property in the object's prototype chain that has the attribute DontEnum.

In short, beware when naming your object properties. If there is a built-in prototype property or method with the same name then IE will skip over it when using a for...in loop.

2 of 11
77

It's not possible with ES3 as the properties have an internal DontEnum attribute which prevents us from enumerating these properties. ES5, on the other hand, provides property descriptors for controlling the enumeration capabilities of properties so user-defined and native properties can use the same interface and enjoy the same capabilities, which includes being able to see non-enumerable properties programmatically.

The getOwnPropertyNames function can be used to enumerate over all properties of the passed in object, including those that are non-enumerable. Then a simple typeof check can be employed to filter out non-functions. Unfortunately, Chrome is the only browser that it works on currently.

​function getAllMethods(object) {
    return Object.getOwnPropertyNames(object).filter(function(property) {
        return typeof object[property] == 'function';
    });
}

console.log(getAllMethods(Math));

logs ["cos", "pow", "log", "tan", "sqrt", "ceil", "asin", "abs", "max", "exp", "atan2", "random", "round", "floor", "acos", "atan", "min", "sin"] in no particular order.

🌐
W3Schools
w3schools.com › js › js_objects.asp
JavaScript Objects
Getters and setters allow you to define Object Accessors (Computed Properties). ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
Reddit
reddit.com › r/learnjavascript › what are the use of javascript objects?
r/learnjavascript on Reddit: What are the use of javascript objects?
December 19, 2019 -

I'm a beginner to javascript and I am currently learning objects. The examples that have been provided are mostly about games. I understand that objects are used to hold related data but how can this be functional in web development? I am still learning objects and this might make sense later on but I am just curious if someone can explain it.

🌐
javascript.com
javascript.com › learn › objects
Learn to use JavaScript objects with this free resource
JavaScript objects are variables that contain multiple data values. The values within a JS object are known as properties.
🌐
Stackademic
blog.stackademic.com › javascript-objects-a-comprehensive-guide-1904ed271f19
JavaScript Objects: A Comprehensive Guide | by devShefali | Stackademic
June 12, 2024 - Objects are used for representing complex data structures, organizing code, and creating classes and instances through object-oriented programming. In JavaScript, there are the following ways to create objects.
🌐
Cinthialandia
cinthialandia.com › blog › object
What is an object in javascript? and what are their methods? | Cinthialandia
What is an object? A literal object in JavaScript is a type of data that is declared with a variable that is used to store the collection of items with values
🌐
Altcademy
altcademy.com › blog › what-are-objects-in-javascript
What are Objects in JavaScript?
April 27, 2023 - JavaScript is a powerful and flexible programming language, and one of its most important concepts is the use of objects. Objects are a way to group related data and functions together, making it easier to manage and understand complex code.
🌐
BrainStation®
brainstation.io › learn › javascript › object
JavaScript Object (2026 Tutorial & Examples) | BrainStation®
February 4, 2025 - JavaScript objects put simply are just a collection of key-value pairs to define a real world entity in our code. Let’s take an example of building a web application for an educational organization where entities in the application would be ...