When to use a colon and when to use an = sign

hello everyone. I think I don't know when to use an '=' or a ':' in an expression in JS. Can anyone kindly explain?

2 Likes

could you give some examples of what you dont understand?

read this blog may be help full

: is used inside objects for key-value pairs, and in ternary operators, and in destructuring when you both destructure and assign value to new variable
= is an assignment operator, it assign values of what is to the right of it to what is to the left of it.

1 Like

Thanks a lot everybody. Iā€™m grateful

ok, I have to specially thank you for this, It has helped me understand destructuring.