What is property in javascript?

I am trying to understand objects and I do not understand what it means when the word property is used? I know what is key and values are but what is property?

A property is the association between an object key and its value, similar to how a variable is the association between a name and a value. So if you have an object like let x = {foo: 123}, then “the x.foo property” is referring to the pair of the key “foo” and its value 123. Think of a property as the named box that values go in.

It’s a bit of an ambiguous term: sometimes people will use it when they just mean “key”, sometimes when they mean the value that belongs to the key.

The Javascript language uses both. So we have Object.keys() but also Object.hasOwnProperty() - both referring to the key or keys of an object and not to the values.

Property is also used when talking about a class and is used in contrast to method. So strictly speaking, you could say that a property is any key of an object which is not a function.

Hard to understand if everything is a property.
If you look an object as an keys:values elements therefor the keys are the propertys. It’s also considered as the state value of the objects.These property can change(person_weight, car_color,…). JavaScript consider the method as property too where other Oriented Object langages like Java make a separation between then. So what I understand is that: property is something that define the object

so e.g.

let my Obj = {
  name: "Ammar"

name is the key and property (interchangeable names) or the whole name: "Ammar" is property?

MDN is your best resource for JavaScript questions:


Looks like chuckadams was right. Formally a property consists of a property name and property value, which are equivalent to an object key and object value.