Greetings, there is an object and I need to create on the basis of it another 3 by passing different parameters to them, respectively, these objects will also be output by different parameters.
Here is my non-working example .
var names = ['Вася','Петя','Гриша'], objs = []; var foo = { bar : function(name){ this.name = name; }, baz : function(){ console.log('Ваше ммя: ' + this.name); } }; for(var i in names) objs[ i ] = new foo; objs[ i ].bar( names[ i ] ); for(i in objs) $('#names').append('<li>' + objs[ i ].baz() + '</li>');