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


Groups > comp.lang.javascript > #32684

Re: Copy full array element.

Newsgroups comp.lang.javascript
Date 2017-03-04 14:28 -0800
References <980da03d-c451-40b0-80fd-154b3ed88eb2@googlegroups.com> <bc338550-9213-4493-921a-3818db7e4180@googlegroups.com>
Message-ID <3293ad20-bb89-4ca8-92a8-3764deb980fc@googlegroups.com> (permalink)
Subject Re: Copy full array element.
From jonas.thornvall@gmail.com

Show all headers | View raw


Den lördag 4 mars 2017 kl. 23:02:38 UTC+1 skrev jonas.t...@gmail.com:
> Den lördag 4 mars 2017 kl. 22:55:28 UTC+1 skrev jonas.t...@gmail.com:
> > This is the attributes of my array element 
> >      arr[m] = {
> >             nodelinks: [],
> >             hold: false,
> >             rposX: 0,
> >             rposY: 0,
> >             rwidth: 10,
> >             rheigth: 10,
> >             rcolor: "red",
> >             bcolor: "green",
> >             print: true
> >         };
> > 
> > When i remove an element i want to replace it with the last one, and then pop last element.
> > 
> > How do i do that? Well i know howto do it doing each attribute at a time, but is there a way to just update the full array element in one step? 
> > 
> > function reOrderArr(){
> >   arr[t]=arr[arr.length-1];
> >   arr.pop();
> > }
> 
> In the case above arr.pop(); will not remove any element, nor will it do the copy. Array size stay the same i get no error messages in console but nothing happen.

Solved

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


Thread

Copy full array element. jonas.thornvall@gmail.com - 2017-03-04 13:55 -0800
  Re: Copy full array element. jonas.thornvall@gmail.com - 2017-03-04 14:02 -0800
    Re: Copy full array element. jonas.thornvall@gmail.com - 2017-03-04 14:28 -0800
      Re: Copy full array element. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-03-04 15:35 -0800
    Re: Copy full array element. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-03-04 23:53 +0100
      Re: Copy full array element. jonas.thornvall@gmail.com - 2017-03-04 15:11 -0800
        Re: Copy full array element. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-03-05 10:40 +0100

csiph-web