Answer:
function getDay(s, k){
var weekDays = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];
var index=weekDays.findIndex(function(weekDay){return weekDay==s;});
return weekDays[(index+k)%7];
}
Explanation:
//this functions receive the next parameters:
//s which is the day of the week
//k the number of days after s week day
function getDay(s, k){
var weekDays = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];
//variable index is the index in list weekDays of s
var index=weekDays.findIndex(function(weekDay){return weekDay==s;});
//use module operator % to get the remainder of the division (index+k)/7
//return the string value of the day
return weekDays[(index+k)%7];
}