Assignment Operator?

Assignment Operator?
0

#1

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 :slight_smile:


#3

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?


#4

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 for further info)


#5

Aha i see Thanks Guys really help full :smile: