Apps script: filter out empty elements from arrayjQuery Tips and TricksRemove empty elements from an array in JavascriptHow do I find out which DOM element has the focus?Deleting array elements in JavaScript - delete vs spliceHow do I empty an array in JavaScript?Find the min/max element of an Array in JavaScriptHow do I remove a particular element from an array in JavaScript?How can I add new array elements at the beginning of an array in Javascript?Remove duplicate values from JS arrayHow to add an API Key to a UrlFetchApp in Google Apps Scripts

How to create a consistent feel for character names in a fantasy setting?

Why airport relocation isn't done gradually?

OA final episode explanation

What does 'script /dev/null' do?

Does the average primeness of natural numbers tend to zero?

Is it wise to focus on putting odd beats on left when playing double bass drums?

Mapping arrows in commutative diagrams

Is it possible to make sharp wind that can cut stuff from afar?

Unbreakable Formation vs. Cry of the Carnarium

Is domain driven design an anti-SQL pattern?

Symmetry in quantum mechanics

What do the Banks children have against barley water?

Shall I use personal or official e-mail account when registering to external websites for work purpose?

"listening to me about as much as you're listening to this pole here"

Is Fable (1996) connected in any way to the Fable franchise from Lionhead Studios?

Is Social Media Science Fiction?

aging parents with no investments

Calculate Levenshtein distance between two strings in Python

COUNT(id) or MAX(id) - which is faster?

How can I fix this gap between bookcases I made?

Check if two datetimes are between two others

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

Can a planet have a different gravitational pull depending on its location in orbit around its sun?

Why was the "bread communication" in the arena of Catching Fire left out in the movie?



Apps script: filter out empty elements from array


jQuery Tips and TricksRemove empty elements from an array in JavascriptHow do I find out which DOM element has the focus?Deleting array elements in JavaScript - delete vs spliceHow do I empty an array in JavaScript?Find the min/max element of an Array in JavaScriptHow do I remove a particular element from an array in JavaScript?How can I add new array elements at the beginning of an array in Javascript?Remove duplicate values from JS arrayHow to add an API Key to a UrlFetchApp in Google Apps Scripts






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















enter image description here



I have the following function:



 var rows = sheet2Json(sheet);

var emails = rows.filter(function (el) //ONLY CHECKED ROWS.
return el != "";
)
.map(function (row) //ONLY CHECKED ROWS.
return row['EMAIL'];
);



Logger.log(emails)
return (emails);
}


rows produces the sheet in an array of objects that looks like:



[ EMAIL=xxx, TEMPLATE=CONSULT, Index=Thu Jan 24 16:26:02 GMT-05:00 2019 
...
]


I want an array of all the emails filtering out the empty rows. With the code above I'm getting:



[ K@DF.COM, K@DF.COM, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ]


How can I get rid of the empty rows?










share|improve this question




























    0















    enter image description here



    I have the following function:



     var rows = sheet2Json(sheet);

    var emails = rows.filter(function (el) //ONLY CHECKED ROWS.
    return el != "";
    )
    .map(function (row) //ONLY CHECKED ROWS.
    return row['EMAIL'];
    );



    Logger.log(emails)
    return (emails);
    }


    rows produces the sheet in an array of objects that looks like:



    [ EMAIL=xxx, TEMPLATE=CONSULT, Index=Thu Jan 24 16:26:02 GMT-05:00 2019 
    ...
    ]


    I want an array of all the emails filtering out the empty rows. With the code above I'm getting:



    [ K@DF.COM, K@DF.COM, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ]


    How can I get rid of the empty rows?










    share|improve this question
























      0












      0








      0








      enter image description here



      I have the following function:



       var rows = sheet2Json(sheet);

      var emails = rows.filter(function (el) //ONLY CHECKED ROWS.
      return el != "";
      )
      .map(function (row) //ONLY CHECKED ROWS.
      return row['EMAIL'];
      );



      Logger.log(emails)
      return (emails);
      }


      rows produces the sheet in an array of objects that looks like:



      [ EMAIL=xxx, TEMPLATE=CONSULT, Index=Thu Jan 24 16:26:02 GMT-05:00 2019 
      ...
      ]


      I want an array of all the emails filtering out the empty rows. With the code above I'm getting:



      [ K@DF.COM, K@DF.COM, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ]


      How can I get rid of the empty rows?










      share|improve this question














      enter image description here



      I have the following function:



       var rows = sheet2Json(sheet);

      var emails = rows.filter(function (el) //ONLY CHECKED ROWS.
      return el != "";
      )
      .map(function (row) //ONLY CHECKED ROWS.
      return row['EMAIL'];
      );



      Logger.log(emails)
      return (emails);
      }


      rows produces the sheet in an array of objects that looks like:



      [ EMAIL=xxx, TEMPLATE=CONSULT, Index=Thu Jan 24 16:26:02 GMT-05:00 2019 
      ...
      ]


      I want an array of all the emails filtering out the empty rows. With the code above I'm getting:



      [ K@DF.COM, K@DF.COM, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ]


      How can I get rid of the empty rows?







      javascript google-apps-script






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 22:44









      user61629user61629

      9,21337144273




      9,21337144273






















          2 Answers
          2






          active

          oldest

          votes


















          2














          You have to get the EMAIL property first, then filter the entries which are empty or undefined:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .map(function (row) return row && row.EMAIL; )
          .filter(Boolean);

          console.log(emails);





          The reason it's not working the other way is that you need to filter out the empty EMAIL fields, but you are filtering rows by comparing them to an empty string. An empty row () will not pass your filter test.



          To make it work the other way, you need to filter the rows based on their EMAIL property first, then map:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .filter(function (row) return row && row.EMAIL; )
          .map(function (row) return row.EMAIL; );

          console.log(emails);








          share|improve this answer

























          • Apps Script is basically JS 1.6. No includes, no let, no iterators, no arrow syntax. It does have map, filter, reduce, some, and every support.

            – user61629
            Mar 8 at 1:26











          • Why doesn't it work the other way?

            – user61629
            Mar 8 at 2:13











          • @user61629, I updated the answer and added more explanations

            – jo_va
            Mar 8 at 7:15






          • 1





            Thank you very much!

            – user61629
            Mar 8 at 12:57











          • regarding "return row && row.EMAIL;" - I'm assuming that means if row exists return row.Email ?

            – user61629
            Mar 8 at 13:05


















          1














          • You want to retrieve the values of EMAIL from the object like [ EMAIL=xxx, TEMPLATE=CONSULT, Index=Thu Jan 24 16:26:02 GMT-05:00 2019 ...] using Google Apps Script.

          If my understanding is correct, How about this modification? In this modification, I used reduce(). Please think of this as just one of several answers.



          Modified script:



          var emails = rows.reduce(function (ar, row) 
          row['EMAIL'] && ar.push(row['EMAIL']);
          return ar;
          , []);


          Reference:



          • reduce()





          share|improve this answer























          • Thank you! its a great example!

            – user61629
            Mar 8 at 13:02











          • regarding "row['EMAIL'] && ar.push(row['EMAIL']" - does this mean "if email exists push it to the accumulator array" ?

            – user61629
            Mar 8 at 13:34











          • @user61629 Yes. That's right. Also, By putting row['EMAIL'] before ar.push(row['EMAIL']), at first, row['EMAIL'] is compared.

            – Tanaike
            Mar 9 at 1:14











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55054012%2fapps-script-filter-out-empty-elements-from-array%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          You have to get the EMAIL property first, then filter the entries which are empty or undefined:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .map(function (row) return row && row.EMAIL; )
          .filter(Boolean);

          console.log(emails);





          The reason it's not working the other way is that you need to filter out the empty EMAIL fields, but you are filtering rows by comparing them to an empty string. An empty row () will not pass your filter test.



          To make it work the other way, you need to filter the rows based on their EMAIL property first, then map:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .filter(function (row) return row && row.EMAIL; )
          .map(function (row) return row.EMAIL; );

          console.log(emails);








          share|improve this answer

























          • Apps Script is basically JS 1.6. No includes, no let, no iterators, no arrow syntax. It does have map, filter, reduce, some, and every support.

            – user61629
            Mar 8 at 1:26











          • Why doesn't it work the other way?

            – user61629
            Mar 8 at 2:13











          • @user61629, I updated the answer and added more explanations

            – jo_va
            Mar 8 at 7:15






          • 1





            Thank you very much!

            – user61629
            Mar 8 at 12:57











          • regarding "return row && row.EMAIL;" - I'm assuming that means if row exists return row.Email ?

            – user61629
            Mar 8 at 13:05















          2














          You have to get the EMAIL property first, then filter the entries which are empty or undefined:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .map(function (row) return row && row.EMAIL; )
          .filter(Boolean);

          console.log(emails);





          The reason it's not working the other way is that you need to filter out the empty EMAIL fields, but you are filtering rows by comparing them to an empty string. An empty row () will not pass your filter test.



          To make it work the other way, you need to filter the rows based on their EMAIL property first, then map:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .filter(function (row) return row && row.EMAIL; )
          .map(function (row) return row.EMAIL; );

          console.log(emails);








          share|improve this answer

























          • Apps Script is basically JS 1.6. No includes, no let, no iterators, no arrow syntax. It does have map, filter, reduce, some, and every support.

            – user61629
            Mar 8 at 1:26











          • Why doesn't it work the other way?

            – user61629
            Mar 8 at 2:13











          • @user61629, I updated the answer and added more explanations

            – jo_va
            Mar 8 at 7:15






          • 1





            Thank you very much!

            – user61629
            Mar 8 at 12:57











          • regarding "return row && row.EMAIL;" - I'm assuming that means if row exists return row.Email ?

            – user61629
            Mar 8 at 13:05













          2












          2








          2







          You have to get the EMAIL property first, then filter the entries which are empty or undefined:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .map(function (row) return row && row.EMAIL; )
          .filter(Boolean);

          console.log(emails);





          The reason it's not working the other way is that you need to filter out the empty EMAIL fields, but you are filtering rows by comparing them to an empty string. An empty row () will not pass your filter test.



          To make it work the other way, you need to filter the rows based on their EMAIL property first, then map:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .filter(function (row) return row && row.EMAIL; )
          .map(function (row) return row.EMAIL; );

          console.log(emails);








          share|improve this answer















          You have to get the EMAIL property first, then filter the entries which are empty or undefined:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .map(function (row) return row && row.EMAIL; )
          .filter(Boolean);

          console.log(emails);





          The reason it's not working the other way is that you need to filter out the empty EMAIL fields, but you are filtering rows by comparing them to an empty string. An empty row () will not pass your filter test.



          To make it work the other way, you need to filter the rows based on their EMAIL property first, then map:






          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .filter(function (row) return row && row.EMAIL; )
          .map(function (row) return row.EMAIL; );

          console.log(emails);








          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .map(function (row) return row && row.EMAIL; )
          .filter(Boolean);

          console.log(emails);





          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .map(function (row) return row && row.EMAIL; )
          .filter(Boolean);

          console.log(emails);





          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .filter(function (row) return row && row.EMAIL; )
          .map(function (row) return row.EMAIL; );

          console.log(emails);





          var rows = [
          EMAIL: 'a@b.com', prop: 'bla' ,
          EMAIL: '', prop: 'bla' ,
          EMAIL: undefined ,
          EMAIL: 'd@b.com', prop: 'bla' ,
          ,
          undefined
          ];

          var emails = rows
          .filter(function (row) return row && row.EMAIL; )
          .map(function (row) return row.EMAIL; );

          console.log(emails);






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 8 at 7:13

























          answered Mar 7 at 22:49









          jo_vajo_va

          8,34321031




          8,34321031












          • Apps Script is basically JS 1.6. No includes, no let, no iterators, no arrow syntax. It does have map, filter, reduce, some, and every support.

            – user61629
            Mar 8 at 1:26











          • Why doesn't it work the other way?

            – user61629
            Mar 8 at 2:13











          • @user61629, I updated the answer and added more explanations

            – jo_va
            Mar 8 at 7:15






          • 1





            Thank you very much!

            – user61629
            Mar 8 at 12:57











          • regarding "return row && row.EMAIL;" - I'm assuming that means if row exists return row.Email ?

            – user61629
            Mar 8 at 13:05

















          • Apps Script is basically JS 1.6. No includes, no let, no iterators, no arrow syntax. It does have map, filter, reduce, some, and every support.

            – user61629
            Mar 8 at 1:26











          • Why doesn't it work the other way?

            – user61629
            Mar 8 at 2:13











          • @user61629, I updated the answer and added more explanations

            – jo_va
            Mar 8 at 7:15






          • 1





            Thank you very much!

            – user61629
            Mar 8 at 12:57











          • regarding "return row && row.EMAIL;" - I'm assuming that means if row exists return row.Email ?

            – user61629
            Mar 8 at 13:05
















          Apps Script is basically JS 1.6. No includes, no let, no iterators, no arrow syntax. It does have map, filter, reduce, some, and every support.

          – user61629
          Mar 8 at 1:26





          Apps Script is basically JS 1.6. No includes, no let, no iterators, no arrow syntax. It does have map, filter, reduce, some, and every support.

          – user61629
          Mar 8 at 1:26













          Why doesn't it work the other way?

          – user61629
          Mar 8 at 2:13





          Why doesn't it work the other way?

          – user61629
          Mar 8 at 2:13













          @user61629, I updated the answer and added more explanations

          – jo_va
          Mar 8 at 7:15





          @user61629, I updated the answer and added more explanations

          – jo_va
          Mar 8 at 7:15




          1




          1





          Thank you very much!

          – user61629
          Mar 8 at 12:57





          Thank you very much!

          – user61629
          Mar 8 at 12:57













          regarding "return row && row.EMAIL;" - I'm assuming that means if row exists return row.Email ?

          – user61629
          Mar 8 at 13:05





          regarding "return row && row.EMAIL;" - I'm assuming that means if row exists return row.Email ?

          – user61629
          Mar 8 at 13:05













          1














          • You want to retrieve the values of EMAIL from the object like [ EMAIL=xxx, TEMPLATE=CONSULT, Index=Thu Jan 24 16:26:02 GMT-05:00 2019 ...] using Google Apps Script.

          If my understanding is correct, How about this modification? In this modification, I used reduce(). Please think of this as just one of several answers.



          Modified script:



          var emails = rows.reduce(function (ar, row) 
          row['EMAIL'] && ar.push(row['EMAIL']);
          return ar;
          , []);


          Reference:



          • reduce()





          share|improve this answer























          • Thank you! its a great example!

            – user61629
            Mar 8 at 13:02











          • regarding "row['EMAIL'] && ar.push(row['EMAIL']" - does this mean "if email exists push it to the accumulator array" ?

            – user61629
            Mar 8 at 13:34











          • @user61629 Yes. That's right. Also, By putting row['EMAIL'] before ar.push(row['EMAIL']), at first, row['EMAIL'] is compared.

            – Tanaike
            Mar 9 at 1:14















          1














          • You want to retrieve the values of EMAIL from the object like [ EMAIL=xxx, TEMPLATE=CONSULT, Index=Thu Jan 24 16:26:02 GMT-05:00 2019 ...] using Google Apps Script.

          If my understanding is correct, How about this modification? In this modification, I used reduce(). Please think of this as just one of several answers.



          Modified script:



          var emails = rows.reduce(function (ar, row) 
          row['EMAIL'] && ar.push(row['EMAIL']);
          return ar;
          , []);


          Reference:



          • reduce()





          share|improve this answer























          • Thank you! its a great example!

            – user61629
            Mar 8 at 13:02











          • regarding "row['EMAIL'] && ar.push(row['EMAIL']" - does this mean "if email exists push it to the accumulator array" ?

            – user61629
            Mar 8 at 13:34











          • @user61629 Yes. That's right. Also, By putting row['EMAIL'] before ar.push(row['EMAIL']), at first, row['EMAIL'] is compared.

            – Tanaike
            Mar 9 at 1:14













          1












          1








          1







          • You want to retrieve the values of EMAIL from the object like [ EMAIL=xxx, TEMPLATE=CONSULT, Index=Thu Jan 24 16:26:02 GMT-05:00 2019 ...] using Google Apps Script.

          If my understanding is correct, How about this modification? In this modification, I used reduce(). Please think of this as just one of several answers.



          Modified script:



          var emails = rows.reduce(function (ar, row) 
          row['EMAIL'] && ar.push(row['EMAIL']);
          return ar;
          , []);


          Reference:



          • reduce()





          share|improve this answer













          • You want to retrieve the values of EMAIL from the object like [ EMAIL=xxx, TEMPLATE=CONSULT, Index=Thu Jan 24 16:26:02 GMT-05:00 2019 ...] using Google Apps Script.

          If my understanding is correct, How about this modification? In this modification, I used reduce(). Please think of this as just one of several answers.



          Modified script:



          var emails = rows.reduce(function (ar, row) 
          row['EMAIL'] && ar.push(row['EMAIL']);
          return ar;
          , []);


          Reference:



          • reduce()






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 7 at 23:01









          TanaikeTanaike

          24.2k31327




          24.2k31327












          • Thank you! its a great example!

            – user61629
            Mar 8 at 13:02











          • regarding "row['EMAIL'] && ar.push(row['EMAIL']" - does this mean "if email exists push it to the accumulator array" ?

            – user61629
            Mar 8 at 13:34











          • @user61629 Yes. That's right. Also, By putting row['EMAIL'] before ar.push(row['EMAIL']), at first, row['EMAIL'] is compared.

            – Tanaike
            Mar 9 at 1:14

















          • Thank you! its a great example!

            – user61629
            Mar 8 at 13:02











          • regarding "row['EMAIL'] && ar.push(row['EMAIL']" - does this mean "if email exists push it to the accumulator array" ?

            – user61629
            Mar 8 at 13:34











          • @user61629 Yes. That's right. Also, By putting row['EMAIL'] before ar.push(row['EMAIL']), at first, row['EMAIL'] is compared.

            – Tanaike
            Mar 9 at 1:14
















          Thank you! its a great example!

          – user61629
          Mar 8 at 13:02





          Thank you! its a great example!

          – user61629
          Mar 8 at 13:02













          regarding "row['EMAIL'] && ar.push(row['EMAIL']" - does this mean "if email exists push it to the accumulator array" ?

          – user61629
          Mar 8 at 13:34





          regarding "row['EMAIL'] && ar.push(row['EMAIL']" - does this mean "if email exists push it to the accumulator array" ?

          – user61629
          Mar 8 at 13:34













          @user61629 Yes. That's right. Also, By putting row['EMAIL'] before ar.push(row['EMAIL']), at first, row['EMAIL'] is compared.

          – Tanaike
          Mar 9 at 1:14





          @user61629 Yes. That's right. Also, By putting row['EMAIL'] before ar.push(row['EMAIL']), at first, row['EMAIL'] is compared.

          – Tanaike
          Mar 9 at 1:14

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55054012%2fapps-script-filter-out-empty-elements-from-array%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович