I have a constructor function that serves to push new data to an array (in this case, allEntries
)
function entry (title, info) {
this.title = title;
this.info = [ { name : info } ];
}
var allEntries = []
I'm trying to figure out how to pass multiple objects for this.info
, something like:
allEntries.push( new entry( 'title one', ['info 1', 'info 2'] ) );
in order to obtain something like:
{
title: 'title one',
info : [
{ name: 'info 1'},
{ name: 'info 2'}
]
}
How would I go about doing this?