Skip to content Skip to sidebar Skip to footer

Javascript Merging Parameters

I have an object that looks like this: StandardFormat({ HeaderFont: 'greentext2', HeaderLinkFont: 'bluelink3', Backcolor: 'Black', ... }); So far, I have a fun

Solution 1:

You could do...

functionFormatGrid(ID, Format) {
    var options;
    if (typeofFormat != 'string') {
       options = Format;
    } else {
       options = {
          HeaderFont: arguments[1],
          HeaderLinkFont: arguments[2],
          Backcolor: arguments[3]
       }
    }

    // Here you could then access `options.HeaderFont`.
}

jsFiddle.

This unpacks to window however.

Post a Comment for "Javascript Merging Parameters"