I change places function so that the caller is before called, an error occurs.
What can say this character? Maybe somewhere in the distance of a kilometer bracket is not closed?
UPD: For example, its code work correctly if I place first string at end:
SCRIPT5022: Pass a function that returns the value of the dependentObservable knockout-2.0.0.debug.js, line 1054 character 9
osagoViewModel.fields.yearsBoxes = new field("Years", yearsBoxesFunc, null, osagoViewModel);
function yearsBox() {
this.year = new field("Years", function () { return ["1 year", "2 years", "3 years", "4 years", "5 years", "6 years", "7 years", "8 years", "9 years", "10 years"]; }, null, osagoViewModel);
}
var yearsBoxesFunc = function () {
var yearsBoxCount = osagoViewModel.fields.driversCount.selectedValue();
var retArrFunc = function (count) {
var arr = [];
for (var i = 0; i < count; i++) {
arr.push(new yearsBox());
}
return arr;
};
switch (yearsBoxCount) {
case "many":
return retArrFunc(0);
case "1":
return retArrFunc(1);
case "2":
return retArrFunc(2);
case "3":
return retArrFunc(3);
case "4":
return retArrFunc(4);
case "5":
return retArrFunc(5);
}
}