Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #27127

Re: Remove leading zeros in index of array

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Remove leading zeros in index of array
Date 2015-03-24 20:47 +0100
Organization PointedEars Software (PES)
Message-ID <2204699.Ha36KrdQoR@PointedEars.de> (permalink)
References <2c9d128f-2237-4484-bbbe-2020864ec72a@googlegroups.com> <a2adb$55117781$6def49d7$1008@nntpswitch.blueworldhosting.com> <1518239.EFQcgAjVos@PointedEars.de> <75e22$5511bec1$6def49d7$5093@nntpswitch.blueworldhosting.com>

Show all headers | View raw


Cezary Tomczyk wrote:

> On 2015-03-24 20:21, Thomas 'PointedEars' Lahn wrote:
>> Cezary Tomczyk wrote:
>>> bin = bin.filter(function(element){
>>>       if (element) {
>>>           return element;
>>>       }
>>>       return false;
>>> });
>>
>>    bin = bin.filter(function (e) { return e; });
> 
> Your code is shorter then mine. However, I think it's just less readable
> in my opinion.

Wait till ES 6 (or use Node.js which already supports this):

  bin = bin.filter(e => e);

;-)

<https://github.com/joyent/node/wiki/ES6-%28a.k.a.-Harmony%29-Features-Implemented-in-V8-and-Available-in-Node>

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Remove leading zeros in index of array jonas.thornvall@gmail.com - 2015-03-23 04:57 -0700
  Re: Remove leading zeros in index of array jonas.thornvall@gmail.com - 2015-03-23 10:03 -0700
    Re: Remove leading zeros in index of array Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-23 10:32 -0700
    Re: Remove leading zeros in index of array Tim Streater <timstreater@greenbee.net> - 2015-03-23 18:36 +0000
    Re: Remove leading zeros in index of array "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-23 20:42 +0100
      Re: Remove leading zeros in index of array jonas.thornvall@gmail.com - 2015-03-23 12:58 -0700
        Re: Remove leading zeros in index of array "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-23 21:12 +0100
          Re: Remove leading zeros in index of array jonas.thornvall@gmail.com - 2015-03-23 13:16 -0700
            Re: Remove leading zeros in index of array "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-23 21:36 +0100
              Re: Remove leading zeros in index of array "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-23 21:49 +0100
                Re: Remove leading zeros in index of array "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-23 21:58 +0100
  Re: Remove leading zeros in index of array Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2015-03-24 15:41 +0100
    Re: Remove leading zeros in index of array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-03-24 20:21 +0100
      Re: Remove leading zeros in index of array Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2015-03-24 20:45 +0100
        Re: Remove leading zeros in index of array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-03-24 20:47 +0100
    Re: Remove leading zeros in index of array Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-24 13:37 -0700
      Re: Remove leading zeros in index of array Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2015-03-25 00:01 +0100

csiph-web