what changes are to be made to view and the viewmodel in the following example if the children array has two more fields "child age" and "weight".
view:
<h2>People</h2>
<ul data-bind="foreach: people">
<li>
<div>
<span data-bind="text: name"> </span> has <span data-bind='text: children().length'> </span> children:
</div>
<ul data-bind="foreach: children">
<li>
<span data-bind="text: $data"> </span>
</li>
</ul>
</li>
viewmodel:
var Person = function(name, children) {
this.name = name;
this.children = ko.observableArray(children);
this.addChild = function() {
this.children.push("New child");
}.bind(this);
}
var viewModel = {
people: [
new Person("Annabelle", ["Arnie", "Anders", "Apple"]),
new Person("Bertie", ["Boutros-Boutros", "Brianna", "Barbie", "Bee-bop"]),
new Person("Charles", ["Cayenne", "Cleopatra"])
],
};
ko.applyBindings(viewModel);