# Assignment Operator?

**URL:** <https://forum.freecodecamp.org/t/assignment-operator/64771>\
**Category:** General\
**Created:** [December 12, 2016, 11:18pm UTC](https://forum.freecodecamp.org/t/assignment-operator/64771 "2016-12-12T23:18:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon94498690](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@anon94498690](https://forum.freecodecamp.org/u/anon94498690)\
**Post date:** [December 12, 2016, 11:18pm UTC](https://forum.freecodecamp.org/t/assignment-operator/64771/1 "2016-12-12T23:18:08Z")

</div>

I want to know what this “:” sign or operator i don’t know what it is to Javascript Anyway i want to know what it does what is it used for  
the code i saw was something like this  
dtsg:document.getElementById(‘text’).value  
anyway if this wasn’t irrelevant i would like the moderators to delete this topic and just send me the answer privately Thanks 🙂

---

<div class="post-metadata">

**Author:** ![anon94498690](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@anon94498690](https://forum.freecodecamp.org/u/anon94498690)\
**Post date:** [December 12, 2016, 11:50pm UTC](https://forum.freecodecamp.org/t/assignment-operator/64771/3 "2016-12-12T23:50:39Z")

</div>

But when i use it the chrome console as something like this  
Number:5  
it give me back 5 with it being inside and object what does that means?

---

<div class="post-metadata">

**Author:** ![sceadgugenga](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sceadgugenga/32/14236_2.png) [@sceadgugenga](https://forum.freecodecamp.org/u/sceadgugenga)\
**Post date:** [December 12, 2016, 11:55pm UTC](https://forum.freecodecamp.org/t/assignment-operator/64771/4 "2016-12-12T23:55:08Z")

</div>

Colons serve a few functions, depending on where and how they are used.

In this case it could be be object literal notation assigning the value of the element with the ‘text’ id to the object property of dtsg.

I suppose that it could also be designating dtsg as a label. It is difficult to tell out of context.

Other uses of the colon is in a tertiary statement condition ? expression1 : expression2 (see [MDN Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator) for further info)

---

<div class="post-metadata">

**Author:** ![anon94498690](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@anon94498690](https://forum.freecodecamp.org/u/anon94498690)\
**Post date:** [December 13, 2016, 12:02am UTC](https://forum.freecodecamp.org/t/assignment-operator/64771/5 "2016-12-13T00:02:31Z")

</div>

Aha i see Thanks Guys really help full 😄

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [January 16, 2021, 6:10am UTC](https://forum.freecodecamp.org/t/assignment-operator/64771/6 "2021-01-16T06:10:39Z")

</div>

Closed on January 16, 2021, 6:10am UTC


