title: How do I rewrite this code for V8 from Rhino?
body: <p>I used to a script on GAS.
  Because I do manage attendance by Chat and Google spread sheet with GAS.
  Chat tool is Chat work.
  It works on Gas(Rhino).
  But It doesn't work V8.</p>
  
  <p>I tried to rewrite line19 <code>for each (var obj in json){</code> to <code>for (var obj in json){</code></p>
  
  <p>Please tell me what is bad...
  Which should I rewrite it?</p>
  
  <pre><code>function recordTime(){
    /*Sheet setting*/
    var wsData = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("data"); //DataSheetSetting
    var wsStaff = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("coworkers"); //CoworkersMasterSetting
    /*ChatworkURLrequest*/
    var params = {
      headers : {"X-ChatWorkToken" : 'anynumber'},
      method : "get"
    };
    var roomID = anynumber; //ROOMID
    var url = "https://api.chatwork.com/v2/rooms/" + roomID + "/messages?force=0"; //GetMessageFromGroupchat
    try{
      var respons = UrlFetchApp.fetch(url, params); //GetResponseFromChatworkAPIendpoint
      var json = JSON.parse(respons.getContentText()); //Returnjson
      for each(var obj in json){　//I understand that I should rewrite "for (var obj in json){
        /*Get YMDhm and ID*/      
        var date = new Date(obj.send_time*1000); 
        var date_D = new Date(date.getFullYear(),date.getMonth(),date.getDate(),0,0,0); 
        var date_T = new Date(date.getFullYear(),date.getMonth(),date.getDate(),date.getHours(),date.getMinutes(),0); 　
        var date_TH = new Date(0,0,0,date.getHours(),date.getMinutes(),0); 　
        /*dateToSn Setting*/      
        var MILLIS_DIFFERENCE = 9 * 60 * 60 * 1000; 
        var COEFFICIENT = 24 * 60 * 60 * 1000; 
        var DATES_OFFSET = 70 * 365 + 17 + 1 + 1; 
        function dateToSn(date){ //Date→Serial
          return convertUt2Sn(date.getTime());
        }
        function convertUt2Sn(unixTimeMillis){ //UNIX→Serial
          return (unixTimeMillis + MILLIS_DIFFERENCE) / COEFFICIENT + DATES_OFFSET;
        }
        /*findRow*/      
        function findRow(sheet,val,col){
          var dat = sheet.getDataRange().getValues(); 
          for(var i=1;i&lt;dat.length;i++){
            if(dat[i][col-1] === val){
              return i+1;
            }
          }
          return 0;
        }
        /*StaffID*/
        var staffID = wsStaff.getRange(findRow(wsStaff,obj.account.account_id,1),2).getValue(); 
        var dataRow=findRow(wsData,dateToSn(date_D)+staffID.toString(),1);      
        if(obj.body.match(/出勤/)){ 
          if(!dataRow){
            wsData.appendRow(
              ["=INDIRECT(\"RC[1]\",FALSE) &amp; INDIRECT(\"RC[2]\",FALSE)",date_D,
               "=VLOOKUP(" + obj.account.account_id + ",'coworkers'!A:B,2,FALSE)","=VLOOKUP(" + obj.account.account_id + ",'coworkers'!A:E,4,FALSE)","出勤",date_T
              ]);    
          }
        }else if(obj.body.match(/外出/) || obj.body.match(/直行/)){
          if(dataRow){
            var rng = wsData.getRange(dataRow,8);
            if(!rng.getValue()){
              rng.setValue(date_T);
            }
          }
        }else if(obj.body.match(/帰社/) || obj.body.match(/直帰/)){
          if(dataRow){
            var rng = wsData.getRange(dataRow,9);
            if(!rng.getValue()){
              rng.setValue(date_T);
            }
          }
        }else if (obj.body.match(/中抜け/)){
          if(dataRow){
            var rng = wsData.getRange(dataRow,10);
            if(!rng.getValue()){
              rng.setValue(date_T);
            }
          }
        }else if (obj.body.match(/戻り/)){
          if(dataRow){
            var rng = wsData.getRange(dataRow,11);
            if(!rng.getValue()){
              rng.setValue(date_T);
            }
          }
        }else if(obj.body.match(/退勤/)){
          if(dataRow){
            var rng = wsData.getRange(dataRow,7);
            if(!rng.getValue()){
              rng.setValue(date_T);
            }
          }
        }
      }
    }catch(e){
      Logger.log('Error');
      Logger.log(e.message);
    }
  }
  </code></pre>