ChApter 1 ■ JAvASCrIpt You Need to KNow
you now have to interpret this as “Store the current value of myNumber into myNumber, and then increment the
value.” In this case, the net result is that the increment happens after the assignment operation, so the myNumber
variable never actually receives the updated (incremented) value. The same principle applies to the pre- and
post-decrement (--) operators.
Working with Objects
Objects are often used as containers for data, but they can be home to functions too. They are a particularly versatile
aspect of the JavaScript language, and it is very important to get a decent handle on this concept.
Creating Objects
Let’s start our brief look at objects by seeing how they are created. Listing 1-17 demonstrates the usual way to create
an object.
Listing 1-17. Creating Objects
<!DOCTYPE html>