We have created the follow JavaScript variable, which works fine:
function evaluate() {
return new function() {
var startDate = new Date().toISOString().slice(0, 10);
startDate = new Date(startDate.replace(/-/g, "/"));
var endDate = "", noOfDaysToAdd = 1, count = 0;
while(count < noOfDaysToAdd){
endDate = new Date(startDate.setDate(startDate.getDate() + 1));
if(endDate.getDay() != 0 && endDate.getDay() != 6){
count++;
}
}
var day = endDate.getDate();
var month = endDate.getMonth() + 1;
var year = endDate.getFullYear();
this.futureDate = day + '.' + month + '.' + year;
}
}
We would like to inject a string variable into this JavaScript variable. E.g. we want to set noOfDaysToAdd in another variable and not inside the JavaScript for easier maintenance. Is that possible?