🌐
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.
🌐
W3Schools
w3schools.com › js › js_objects.asp
JavaScript Objects
Getters and setters allow you to define Object Accessors (Computed Properties). ... Coding fundamentals as a game. Bite-sized lessons and challenges. ... Ready to start your journey? Your streak is waiting. ... 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
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Working_with_objects
Working with objects - JavaScript | MDN
August 21, 2026 - JavaScript is designed on an object-based paradigm. An object is a collection of properties, and a property is an association between a name (or key) and a value. A property's value can be a function, in which case the property is known as a method.
🌐
Codecademy
codecademy.com › learn › game-dev-learn-javascript-objects › modules › game-dev-learn-javascript-objects › cheatsheet
Learn JavaScript: Objects: Learn JavaScript: Objects Cheatsheet | Codecademy
It uses a pair of curly braces ({}) with property names on the left-hand side of an assignment to extract values from objects. The number of variables can be less than the total properties of an object. ... The shorthand property name syntax in JavaScript allows creating objects without explicitly specifying the property names (ie.
🌐
YouTube
youtube.com › watch
Learn JavaScript OBJECTS in 7 minutes! 🧍 - YouTube
#JavaScript #tutorial #course // object = A collection of related properties and/or methods// Can represent real world objects (people, produc...
Published: November 14, 2023
🌐
Reddit
reddit.com › r/learnjavascript › what is an object
r/learnjavascript on Reddit: What is an object
April 27, 2022 -

HEllo guys, so I'm learning JS and trying react but I can't grasp a good understanding of some of the, apparently, most important terms. One of them is Object, another one is parent/child components, since I seem to find different examples that aren't consistent, and it's especially difficult for me to understand the codeword this, because of the previously explained.

So, my questions are:

what IS an object in JS and what is an object in react?

How do I know what is a parent and what is a child?

How do I understand the "passing props" part of the code?

I'm doing the react turorial Tutorial: Intro to React – React (reactjs.org), and part of it is "passing props" but I just don't get how one component is taking value from another when I can't see any relation between them.

Edit: thank you, everyone, for your answers, I will keep trying to grasps the concepts I'm struggling with before proceeding with anything. An object is now much more clearer but I'm still struggling with the parent/child and the passing of props but I'll keep reading.

🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Core › Scripting › Object_basics
JavaScript object basics - Learn web development | MDN
3 weeks ago - Every time we've been working through an example that uses a built-in browser API or JavaScript object, we've been using objects, because such features are built using exactly the same kind of object structures that we've been looking at here, albeit more complex ones than in our own basic custom examples.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › objects-in-javascript
Objects in JavaScript - GeeksforGeeks
Understanding objects in JavaScript is essential for effective programming. They enable you to create complex data structures and perform a variety of operations.
Published: January 16, 2026
🌐
Podfeet Podcasts
podfeet.com › blog › tutorials-5 › objects-in-javascript
How almost everything in JavaScript is an Object - by Will aka @beiju - Podfeet Podcasts
April 3, 2018 - And arrays are objects, therefore this makes an object. I’m not sure you agree with this one yet, but I will try to prove it. As Bart has said, the names of all the values in an array are their positions. In the above example, 0 and false is one name-value pair, 1 and 1 is another, and 2 and "two" is a third. You can access the values using those names: myArray[0] gets the value false, etc. The only reason you can’t use the dot syntax here is that JavaScript variables are not allowed to start with a number.
🌐
Medium
medium.com › @developerObsessed › mastering-objects-in-javascript-71511ff8e00e
Mastering Objects in JavaScript. A Comprehensive Guide to Understanding… | by The Obsessed Developer | Medium
July 21, 2023 - Object cloning is a way to create a copy of an object so that any changes made to the copy do not affect the original object. In JavaScript, objects are reference types, and when you copy an object using the assignment operator (=), it creates ...
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › objects: the basics
Objects
As we know from the chapter Data types, there are eight data types in JavaScript. Seven of them are called “primitive”, because their values contain only a single thing (be it a string or a number or whatever). In contrast, objects are used to store keyed collections of various data and more complex entities.
🌐
freeCodeCamp
freecodecamp.org › news › objects-in-javascript-for-beginners
Objects in JavaScript – A Beginner's Guide
November 19, 2024 - Unlike other data types, objects are capable of storing complex values. Because of this, JavaScript relies heavily on them.
🌐
Medium
davitdvalashvili1996.medium.com › everything-you-need-to-know-about-objects-in-javascript-c94e413f8909
Everything You Need to Know About Objects in JavaScript | by DavitDvalashvili | Medium
May 19, 2024 - As explained, objects in JavaScript are core data structures comprising properties and methods. While methods are functions/actions an object can perform, properties are characteristics of an object such as its name and value.
🌐
W3Schools
w3schools.com › js › js_object_intro.asp
JavaScript Objects Learning Path
Objects are variables that can store both values and functions.
🌐
W3Schools
w3schools.com › jsref › jsref_object_values.asp
JavaScript Object.values() Method
The Object.values() method returns an array of the property values of an object.
🌐
The Odin Project
theodinproject.com › lessons › foundations-object-basics
Object Basics | The Odin Project
Congratulations on making it to one of the last lessons in Foundations! By this point, you have learned many of the fundamentals of JavaScript. In this lesson, you will learn about Objects - a collection of key-value pairs - as well as some more powerful and commonly used array methods.
🌐
W3Schools
w3schools.com › js › js_object_methods.asp
JavaScript Object Methods
You can add methods to objects by assigning a function to a property · What are JavaScript Objects? What are Object Properties? What is this in Objects? How to Display JavaScript Objects · What is an Object Constructor? JavaScript Object Definitions · JavaScript Object Advanced this ·
Top answer
1 of 8
186

There is no best way, it depends on your use case.

  • Use way 1 if you want to create several similar objects. In your example, Person (you should start the name with a capital letter) is called the constructor function. This is similar to classes in other OO languages.
  • Use way 2 if you only need one object of a kind (like a singleton). If you want this object to inherit from another one, then you have to use a constructor function though.
  • Use way 3 if you want to initialize properties of the object depending on other properties of it or if you have dynamic property names.

Update: As requested examples for the third way.

Dependent properties:

The following does not work as this does not refer to book. There is no way to initialize a property with values of other properties in a object literal:

var book = {
    price: somePrice * discount,
    pages: 500,
    pricePerPage: this.price / this.pages
};

instead, you could do:

var book = {
    price: somePrice * discount,
    pages: 500
};
book.pricePerPage = book.price / book.pages;
// or book['pricePerPage'] = book.price / book.pages;

Dynamic property names:

If the property name is stored in some variable or created through some expression, then you have to use bracket notation:

var name = 'propertyName';

// the property will be `name`, not `propertyName`
var obj = {
    name: 42
}; 

// same here
obj.name = 42;

// this works, it will set `propertyName`
obj[name] = 42;
2 of 8
118

There is various way to define a function. It is totally based upon your requirement. Below are the few styles :-

  1. Object Constructor
  2. Literal constructor
  3. Function Based
  4. Protoype Based
  5. Function and Prototype Based
  6. Singleton Based

Examples:

  1. Object constructor
var person = new Object();

person.name = "Anand",
person.getName = function(){
  return this.name ; 
};
  1. Literal constructor
var person = { 
  name : "Anand",
  getName : function (){
   return this.name
  } 
} 
  1. function Constructor
function Person(name){
  this.name = name
  this.getName = function(){
    return this.name
  } 
} 
  1. Prototype
function Person(){};

Person.prototype.name = "Anand";
  1. Function/Prototype combination
function Person(name){
  this.name = name;
} 
Person.prototype.getName = function(){
  return this.name
} 
  1. Singleton
var person = new function(){
  this.name = "Anand"
} 

You can try it on console, if you have any confusion.

🌐
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.