Assignment Operator

This lesson explains the use of the assignment operator with object variables.

We'll cover the following

What is an assignment operator?

Assingment is giving a new value to an existing object:

returnTripDuration = tripDuration; // assignment

The assignment is more complicated than the other special operations because it is actually a combination of two operations:

  • Destroying the left-hand side object

  • Copying the right-hand side object to the left-hand side object

svg viewer

Get hands-on with 1400+ tech skills courses.