What does {foo: "bar"} mean

when dealing with javascript what does this mean {foo: “bar”} in terms of a function as an object?

If you ever have need of the word ‘bar’,
instead of typing ‘bar’ out, one letter at a time,
you can read the foo property of the object you created-

calling mynewobject.foo, returns ‘bar’.

It creates an object that contains one property. That property has a key name of foo, and that key called foo contains a vaue of “bar”

If you assign the object to a variable, such as baz, you can retrieve the property value by using either array-index notation, or by accessing the appropriate property of that object.


var baz = {foo: "bar"};
var valueFromArrayIndex = baz[foo];
var valueFromProperty = baz.foo;