JavaScript is always pass-by-value. It is obvious to see that primitive variables are passed with values.
But this is not the case for Objects. As seen in the example below, if we assign the firstObj variable to secondObj, they both reference to the same value in memory. Therefore, when we modify firstObj or secondObj, since we are modifying the same reference, we are changing both and show the same value. This should be considered when using the Object.