Question: What's the simplest way to take any 1-argument function and make it chainable onto another function?

So this would look something like...

```
red = function (target) {target.$.style.backgroundColor("red");}
blue = function (target) {target.$.style.backgroundColor("blue");}
body = $("body");
red(body);
#body is now red
makeFunctionChainable(blue);
body.blue()
#body is now blue

```

Answer: 
If I understand what you're trying to do, you can actually define a global extension to the Object prototype which would allow you to call `red()` or `blue()` on any object.

```js
Object.prototype.red = function()
{
    $(this).css('background-color', 'red');
    return this;
};

Object.prototype.blue = function()
{
    $(this).css('background-color', 'blue');
    return this;
};

```

And then you can use it like so:

```js
$('body').red().blue();

```

*I should note that this is bad practice it you only want to use that with jQuery elements.  

Instead, you should write a jQuery extension for it.*
Chaining is only possible if the element returned by function1 has function2 

**example**

```
var obj = {
  red: function(target) {target.$.style.backgroundColor("red");return this;},
  blue: function(target) {target.$.style.backgroundColor("blue");return this;}
};

```

**and use**

```
obj.red(body).blue(body);

```