Say I have a Form object which has an array of Tab objects.
var Tab = function (options) {
return ($jQuery.extend(true, {
id: 'foo',
title: 'Foo'
}, options));
}
var Form = function (options) {
return ($jQuery.extend(true, {
id: 'foo',
tabs: [new Tab()]
}, options));
}
I can use this:
var myForm = new Form({tabs: [new Tab({id: 'bar'}), new Tab({title: 'Bar'}), new Tab({id: 'bar', title: 'Bar'})]});
To get:
myForm.tabs[0] => {id: 'bar', title: 'foo'}
myForm.tabs[1] => {id: 'foo', title: 'Bar'}
myForm.tabs[2] => {id: 'bar', title: 'Bar'}
But is it possible to somehow do this:
var myForm = new Form({tabs: [{id: 'bar'}, {title: 'Bar'}, {id: 'bar', title: 'Bar'}]});
And get the same result?