ok, this is not really an entry, but its a function i made that other people can use for this contest.
the way it chains the code is perfectly legal.
If somebody uses my function (or at least the idea), plz give me credits
//change function made by NiñoScript
Object.prototype.change = function(what:Object, who) {
/*
.change({property:"", value:})
or
.change({func:"", value:[]})
*/
what.func == undefined ? this[what.property]=what.value : this[what.func](what.value[0], what.value[1]);
return !who ? this : who;
};
//this adds 2 lines to the code
theres 2 ways to call it:
.change({property:"", value:} [,who])
or
.change({func:"", value:[]})
The first one:
.change({property:"", value:})
u say the name of the property in the objectm and then the value (it can even be a function)
The second one:
.change({func:"", value:[]})
you say the name of the function/method of the object you want to call, and in the value, an array with all the parameters.
as a second parameter, you can include the location of the object that you want the function to return, so you can keep chaining the change() calls, if no who is declared, it returns the same object.
if you have any function that needs more than 2 parameters, just change the line:
what.func == undefined ? this[what.property]=what.value : this[what.func](what.value[0], what.value[1]);
to
what.func == undefined ? this[what.property]=what.value : this[what.func](what.value[0], what.value[1], what.value[2], what.value[3], what.value[4], what.value[5], “ETC…”);