var today = new Date();
var tomorrow = today;
tomorrow.setDate(tomorrow.getDate() +1);
function formatDateToString(date) {
var dd = (date.getDate() < 10 ? '0' : '')
+ date.getDate();
return dd;
}
how can I store and use the return value in a variable?
tomorrowwill changetodayand vice-versa as they are the same objectvar ddResult = formatDateToString();the return value dd will now be in ddResult.