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


Groups > comp.lang.javascript > #32682

Copy full array element.

Newsgroups comp.lang.javascript
Date 2017-03-04 13:55 -0800
Message-ID <980da03d-c451-40b0-80fd-154b3ed88eb2@googlegroups.com> (permalink)
Subject Copy full array element.
From jonas.thornvall@gmail.com

Show all headers | View raw


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();
}

Back to comp.lang.javascript | Previous | Next — 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