I have the following JavaScript: 

```
var djs = function (ob) {

    return {
        remove: function () { //removes element
            if (is_array(ob)) {
                for (var i = 0; i < ob.length; i++) 
                    ob[i].parentNode.removeChild(ob[i]);
            } else {
                ob.parentNode.removeChild(ob);
            }
        },
        empty: function () { //makes element empty
            if (is_array(ob)) {
                for (var i = 0; i < ob.length; i++) 
                    ob[i].innerHTML = "";
            } else {
                ob.innerHTML = ""
            }
        },
        html: function (str) { //gets or sets innerHTML
            if (str) {
                if (is_array(ob)) {
                    for (var i = 0; i < ob.length; i++) 
                       ob[i].innerHTML = str;
                } else {
                    ob.innerHTML = str;
                }
            } else {
                if (is_array(ob)) {
                    for (var i = 0; i < ob.length; i++) 
                        rob += ob[i].innerHTML;
                    return rob;
                } else {
                    return ob.innerHTML;
                }
            }
        }
    }
}

```

Here every time I am checking whether `ob` is an array or not and executing code. I want to minimize this, like instead of:

```
if (is_array(ob)) { 
    for (var i = 0; i < ob.length; i++) 
        ob[i].parentNode.removeChild(ob[i]);
} else { 
    ob.parentNode.removeChild(ob); 
}

```

I want to use a function like, `doEval(ob,code,return)`, in this case,

```
doEval(ob,"parentNode.removeChild("+ob+")",NULL);

```

"return" parameter will return if I specify any like `innerHTML`. Can any one help?