添加值连接

时间:2017-03-24 00:15:15

标签: javascript math google-apps-script

而不是" var instance = ..."添加它连接的两个值。任何人都可以建议我需要解决的问题吗?

我试图添加" var startingEmail"价值和" var k"。

感谢您的帮助!

 var startingEmail = sheet.getRange("C2").getDisplayValue();
 var numEmails = sheet.getRange("E2").getDisplayValue();



 var max = numEmails;



 for (var k = 0; k<max; ++k){



 var threads = GmailApp.getInboxThreads(startingEmail,max)[k]; //get max 50 threads starting at most recent thread
 var messages = threads.getMessages()[0];

       var sndr; 
       var rcpnt;
       var srAry = [];



       var sndr = messages.getFrom().replace(/^.+<([^>]+)>$/, "$1"); //http://stackoverflow.com/questions/26242591/is-there-a-way-to-get-the-specific-email-address-from-a-gmail-message-object-in      
       var sndrLower = sndr.toLowerCase;

       var rcpnt = messages.getTo().replace(/^.+<([^>]+)>$/, "$1");
       var rcpntLower = rcpnt.toLowerCase;

       var cc = messages.getCc().replace(/^.+<([^>]+)>$/, "$1");
       var ccLower = cc.toLowerCase;

       //srAry.push(sndr);
       //srAry.push(rcpnt);
       //srAry.push(cc);



    var isIn = joinAddr.search(sndr || rcpnt);

     if(isIn == -1){

      var instance = k;

1 个答案:

答案 0 :(得分:0)

我无法在你的代码中看到这个例子,但听起来你可以在你的变量周围包装Number(),它会执行类型转换,所以代码将执行数学而不是串联为字符串。