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


Groups > comp.lang.javascript > #30284

Re: duplicator an array

Path csiph.com!aioe.org!.POSTED!not-for-mail
From Joao Rodrigues <jr@none.com>
Newsgroups comp.lang.javascript
Subject Re: duplicator an array
Date Sat, 16 Apr 2016 12:01:35 -0300
Organization Aioe.org NNTP Server
Lines 26
Message-ID <netk4f$vsl$1@gioia.aioe.org> (permalink)
References <ea578169-9d58-4249-91b4-e0cbad5a6fd8@googlegroups.com> <nen4e4$ggn$1@dont-email.me> <netb2m$42n$1@news.albasani.net>
NNTP-Posting-Host AQJt2CRo4JlMQqbxtjFa9A.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.javascript:30284

Show key headers only | View raw


On 16/04/2016 09:27, Stefan Weiss wrote:

>
> By the way, ES2015 introduced the spread operator `...`.
> With this operator, you can also write
>
>     this.push(...this.slice(0))
>
> instead of
>
>     this.push.apply(this, this.slice(0))
>

Yeah, the spread operator makes life a lot easier: [1]:

     let arr1 = ['a', 'b'];
     let arr2 = ['c'];
     let arr3 = ['d', 'e'];

     console.log([...arr1, ...arr2, ...arr3]);
     // [ 'a', 'b', 'c', 'd', 'e' ]

[1] <http://www.2ality.com/2015/08/getting-started-es6.html>

Cheers,
Joao Rodrigues

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


Thread

duplicator an array JRough <janis.rough@gmail.com> - 2016-04-13 18:27 -0700
  Re: duplicator an array Aleksandro <aleksandro@gmx.com> - 2016-04-14 01:00 -0300
    Re: duplicator an array JRough <janis.rough@gmail.com> - 2016-04-14 09:53 -0700
    Re: duplicator an array "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-04-14 19:41 +0200
      Re: duplicator an array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-14 22:09 +0200
        Re: duplicator an array Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-14 22:23 +0200
    Re: duplicator an array Stefan Weiss <krewecherl@gmail.com> - 2016-04-16 14:27 +0200
      Re: duplicator an array Joao Rodrigues <jr@none.com> - 2016-04-16 12:01 -0300
        Re: duplicator an array Joao Rodrigues <jr@none.com> - 2016-04-16 13:43 -0300
      Re: duplicator an array Aleksandro <aleksandro@gmx.com> - 2016-04-16 14:13 -0300
  Re: duplicator an array bharat.bandgar009@gmail.com - 2017-05-03 01:33 -0700

csiph-web