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


Groups > comp.lang.javascript > #32692

Re: Copy full array element.

Newsgroups comp.lang.javascript
Subject Re: Copy full array element.
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <980da03d-c451-40b0-80fd-154b3ed88eb2@googlegroups.com> <bc338550-9213-4493-921a-3818db7e4180@googlegroups.com> <XnsA72EF313A3B2Feejj99@194.109.6.166> <e454fb0e-fed3-40c8-a963-4aa1d2a7e7db@googlegroups.com>
Date 2017-03-05 10:40 +0100
Message-ID <XnsA72F6C902E48Aeejj99@194.109.6.166> (permalink)

Show all headers | View raw


jonas.thornvall@gmail.com wrote on 05 Mar 2017 in comp.lang.javascript:

>> Works fine here:
>> 
>> <script type='text/javascript'> 'use strict'
>> 
>> let arr = ['a','b','c'];
>> document.write(arr + '<br>'); // a,b,c
>> 
>> reOrderArr(0);
>> document.write(arr + '<br>'); // c,b
>> 
>> function reOrderArr(t){
>>    arr[t] = arr[arr.length-1];
>>    arr.pop();
>> };
>> 
>> </script>

> Well i tried it but it doesn't work

This is just nonsense, my example works fine.

> i had to do like this.

That it does not work like you expect it to work,
means you should change your expectations, not the code.


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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