Working with variables within javascript console.log function : <p>I am seeing sort of strange behaviour with javascript. I am new to this language, but from what I can see, if you increment a variable (or change it in any way) from within a console.log() method, this actually globally changes the variable.</p>

<pre><code>var a = 0;

console.log(a); //prints 0

console.log(a++); //prints 0, a becomes 1
console.log(a++); //prints 1, a becomes 2
console.log(a++); //prints 2, a becomes 3

console.log(a); //prints 3
</code></pre>

<p>Is this something peculiar to javascript? I would have thought that the variable would not get affected globally and that the last print statement would show a as being 0.</p>
