js循环条件为执行代码后的变量 财富值22

2016-10-26 20:18发布

怎么样改可以让执行代码在timeteam[n] <= endtime 的条件下执行循环?

        //时间         var startdate = new Date("2016-10-24 20:00:00");         var starttime = startdate.getTime();         var enddate = new Date("2016-10-26 20:00:00");         var endtime = enddate.getTime();          var timeteam = new Array();         var s = 0;         var sri = "";         var m;         var n = 0          do{             timeteam[n] = starttime + 1800000*s;             s++;              var myDate = new Date(timeteam[n]);              var m = myDate.getFullYear() + "/" + myDate.getMonth() + "/" + myDate.getDate() + " " + myDate.getHours() + ":" + myDate.getMinutes() + ",";              sri = sri + m;             n++;         }         while(n < 20)          var ss = sri.split(",");         ss.pop();          console.log(ss);