JS Test Page

Look at JS console to see output of the following JS snippets This was to find a way to write a function that keeps it's own incrementer when assigning the function to a variable.
	function increment() {
		var i = 0;
		return function() {  
				i++; 
				console.log("i is " + i); 
				return i;
		};
	};

	var a = increment();
	console.log("a increments 3 times");
	a();
	a();
	a();

	var b = increment();
	console.log("b is now set and increments 2 times");
	b();
	b();

	console.log("a is called again and get incremented once more");
	a();
	
This was to to make sure that objects properties modified by functions are passed by reference.
	var foo = {a:"aaa", b:"bbb"};

	function blah(c) {
		c.c = "ccc";
	}
	console.log("original foo");
	console.log(foo);

	blah(foo);

	console.log("foo now modified because of function blah");
	console.log(foo);