javascript: difference in return value between operators -- and -= : <p>Given the following code:</p>

<pre><code>var x = 0;

function decrement(num) {
  return num--;
}

var y = decrement(x);
console.log(y);    // 0
</code></pre>

<p>Versus the following:</p>

<pre><code>var x = 0;

function decrement(num) {
  return num -= 1;    // this is the only difference between the functions
}

var y = decrement(x);
console.log(y);    // 0
</code></pre>

<p>Why does <code>y--</code> return <code>0</code> from the function while <code>y -= 1</code> returns <code>-1</code>?</p>
