# What is it for the ":" in a variable? \[SOLVED\]

**URL:** <https://forum.freecodecamp.org/t/what-is-it-for-the-in-a-variable-solved/149925>\
**Category:** General\
**Created:** [September 26, 2017, 2:57am UTC](https://forum.freecodecamp.org/t/what-is-it-for-the-in-a-variable-solved/149925 "2017-09-26T02:57:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![syonrod](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/syonrod/32/66126_2.png) [@syonrod](https://forum.freecodecamp.org/u/syonrod)\
**Post date:** [September 26, 2017, 2:57am UTC](https://forum.freecodecamp.org/t/what-is-it-for-the-in-a-variable-solved/149925/1 "2017-09-26T02:57:36Z")

</div>

Example:

var o = { x : 1}

That that’s means?

---

<div class="post-metadata">

**Author:** ![kevcomedia](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevcomedia/32/125737_2.png) [@kevcomedia](https://forum.freecodecamp.org/u/kevcomedia)\
**Post date:** [September 26, 2017, 3:35am UTC](https://forum.freecodecamp.org/t/what-is-it-for-the-in-a-variable-solved/149925/2 "2017-09-26T03:35:39Z")

</div>

It’s like the `=`, but for object properties. Here you have an object with a property named `x`, and that `x` has a value of `1`.

---

<div class="post-metadata">

**Author:** ![owel](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/owel/32/48425_2.png) [@owel](https://forum.freecodecamp.org/u/owel)\
**Post date:** [September 26, 2017, 3:36am UTC](https://forum.freecodecamp.org/t/what-is-it-for-the-in-a-variable-solved/149925/3 "2017-09-26T03:36:22Z")

</div>

You’re defining an object called “o”, that contain key:value pairs.

In your example, you have one key called “x” with a value of 1.  
such that:

```auto
o.x = 1 // here, you're asking what is the value of the key "x" in object "o" 

// you can also ask for the object what are it's keys
Object.keys(o);
// returns an array with one element ["x']

// you can also ask what are it's values
Object.values(o); 
// returns an array [1]

```

You can define multiple keys, like

```auto
var customer = {name: "john", lastname: "doe"}
customer.name // returns "john"
customer.lastname // returns "doe"

```

---

<div class="post-metadata">

**Author:** ![syonrod](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/syonrod/32/66126_2.png) [@syonrod](https://forum.freecodecamp.org/u/syonrod)\
**Post date:** [September 26, 2017, 3:51am UTC](https://forum.freecodecamp.org/t/what-is-it-for-the-in-a-variable-solved/149925/4 "2017-09-26T03:51:56Z")

</div>

Thanks u so much for the explanation!

---

<div class="post-metadata">

**Author:** ![syonrod](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/syonrod/32/66126_2.png) [@syonrod](https://forum.freecodecamp.org/u/syonrod)\
**Post date:** [September 26, 2017, 3:52am UTC](https://forum.freecodecamp.org/t/what-is-it-for-the-in-a-variable-solved/149925/5 "2017-09-26T03:52:49Z")

</div>

Thank u so much for taking the time to answer!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:39pm UTC](https://forum.freecodecamp.org/t/what-is-it-for-the-in-a-variable-solved/149925/6 "2021-01-17T20:39:02Z")

</div>

Closed on January 17, 2021, 8:39pm UTC


