How can I add values to an array using a loop. I have been added values to the array by hard cording values, but I need to add huge data to an array.so its so difficult to by hard coding. this part of my JS code.
function BModel(checkInOrEdit) {
"use strict";
this.Number = ko.observable("");
this.Years = ko.observableArray(['', '2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003', '2002', '2001', '2000']);
}
BModel.prototype = {
addTo: function (isSupervised) {
"use strict";
this.fname($.trim(this.fname()));
this.lname($.trim(this.lname()));
},
AcDone: function (result, stat) {
"use strict";
var validationResults = JSON.parse(result.d);
var msgTitle = '';
}
}
$(document).ready(function () {
});
I need to add values to Years since this year up to 1900.how can I do this. Currently, I'm hard corded.
this.Years = ko.observableArray(['', '2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003', '2002', '2001', '2000']);