var d = new Date(); var newdate = new Date(d); var nd = Date(); while (nd.getDay() != 3) { newdate.setDate(newdate.getDate()-1); var nd = new Date(newdate); }
Done