jsContract is a tool for implementing code contracts in Javascript.
Its home is currently http://github.com/oyvindkinsey/jsContract
Code contracts are implemented as a series of statements in the head of each function supporting both pre- and postconditions.
	myFunction(a,b,c) {
		Contract.expectNumber(a,"a is not a number");
		Contract.guaranteesString("The result was not a string");
To support postconditions one has to instrument the script (rewrite it) using a call to Contract.instrument , such as
	var script = ".......";
	var instrumented = Contract.instrument(script);
One can also use the Contract framework to asynchronously load and instrument files using Contract.load
In the left textbox you will find an example of a class that is set up with code contracts.
When run this code will only execute the precondition statements, since the return values are not yet availabe.
To see the instrumented code press the button.

To see the regular and instrumented code in action, take a look at test2.html