Exercise
Let’s put this into practice and get you thinking like a programmer. I want you to do the following:
Now, obviously this isn’t entirely accurate as it doesn’t factor in the day and month of your birth, however you can see how useful JavaScript can be for us when creating these types of dynamic operators.
We have already seen the = assignment operator in the previous section when declaring our variables, but there are many more that can save you a significant amount of time when defining variables. Let’s see the list:
This is the most basic operator, it simply means assign this data to this variable.
This operator assigns a value to a variable and at the same time adds it to its own value. This one makes more sense in practice. Let’s see an example: