Search code examples
javascriptfunctionvariablesredundancy

Javascript variable redundance


I have a simple javascript function like this:

function wrapVar (passVar) {
    var option = {
        varValue: passVar,
        hide: true,
        params: { ..otherparams.. }
        };
    return option;
}

Eclipse and Aptana validation says that the local variable 'option' is redundant. But the meaning of "redundancy" in this case is not clear to me, what should i do to avoid it?


Solution

  • Probably, it means you can use the equivalent

    function wrapVar (passVar) {
        return {
            varValue: passVar,
            hide: true,
            params: { ..otherparams.. }
        };
    }