I tried looking online everywhere for past hour, but I can\'t seem to figure out when to use colon operator :
vs =
operator in javascript? From wh
The colon(:) operator as you correctly stated, is used to define an object property:
var object = {
property:value
}
The equals(=) operator is used to assign values to something, a variable, an array etc.
If you only defined your object as:
var object = {}
You could assign properties to it like this:
object.property = value;