Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32685
| 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> |
| Date | 2017-03-04 23:53 +0100 |
| Message-ID | <XnsA72EF313A3B2Feejj99@194.109.6.166> (permalink) |
jonas.thornvall@gmail.com wrote on 04 Mar 2017 in comp.lang.javascript:
>> function reOrderArr(){
function reOrderArr(t){
>> 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.
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>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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