Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #27665
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2015-05-16 02:58 -0700 |
| References | <2ddccd07-49e4-42c3-9ecc-27f047078f84@googlegroups.com> <XnsA49C7649C3FD7eejj99@194.109.133.246> |
| Message-ID | <fdb99a69-c853-4c3a-baca-b2de2d605a12@googlegroups.com> (permalink) |
| Subject | Re: Reverse elements in array, they can be integers or strings. |
| From | jonas.thornvall@gmail.com |
Den lördag 16 maj 2015 kl. 11:37:44 UTC+2 skrev Evertjan.: > jonas.thornvall@gmail.com wrote on 16 mei 2015 in comp.lang.javascript: > > > I have arrays that are read from right to left, to do arithmetic upon. > > arrays do not have right or left. > You again are making up your own terminology. > > > But at some point i of course want a printout of the elements of the > > array. > > Why "of course"? > > If you want to print out the inverse of an array: > > var arrlen = arr.length; > for (var i=arrlen;;i--) document.write(arr[i-1]+'<br>'); > > > > So i of course reverse the array, > > Why "of course"? > > Reversing an array is a timeconsuming and needless action, > as you can easily use a short formula for an inversed index. > > arr[arrlen-1-i] > > > *but* the integer/string elements > > arrays heve elements, > the type of content of which do not toutch a reversing. > > > of course remain reversed. > > Why "of course"? > So you want to change them back, and again consume exponential time? > > > Is there a preferable way to do this, > > Yes! > > Don't reverse physically, manipulate the index. > > > i do understand that i can make a > > function that reverse > > Well, if you understand that you can do something, it must be okay. > I for one don't understand what you mean. > > > the integer/string digit by digit. > > You must mean "element by element", arrays don't have digits. > Strings too don't have digits, they have characters. > > You again are making up your own terminology. > That is accceptable if you don't pester others with it, > but you eventually fall into your own trap, > when you will misunderstand the publications of others. > > ================================ > > The preferable way is not to inverse long arrays, > as, see above and my earlier mail, > using an index-manipulation-formula has all the necessary ingredients. > > Mind that "preferable" depends on what your goals are, if you want > unreadable, messy, exponential timeconsuming, buggy and difficult to debug > code "of course" your approach might be different. (No i did not mean element by element, i meant what i said. Reverse each element digit by digit) An example Janevert 21 should encode to [1,10] in base eleven because 11+10. But is stored in array as [01,1] Now i want a printout 1,10 And you say i should not physically alter the array at output, and i do not see how it is even possible without touching the array. You could read it into a commaseparated string and reverse that but i doubt that is what you have in mind for efficiency.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 02:03 -0700
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 02:10 -0700
MAX_SAFE_INTEGER & MIN_SAFE_INTEGER, was Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 12:03 +0200
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 11:37 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 02:58 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 12:22 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 03:44 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 14:52 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 06:09 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:30 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 03:37 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:00 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 06:24 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:54 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 07:01 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 21:05 +0200
Re: Reverse elements in array, they can be integers or strings. Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-16 23:07 +0000
Re: Reverse elements in array, they can be integers or strings. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-17 00:28 +0100
Re: Reverse elements in array, they can be integers or strings. Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-17 10:37 +0000
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-17 13:34 +0200
Re: Reverse elements in array, they can be integers or strings. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-16 12:01 +0100
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 04:14 -0700
Re: Reverse elements in array, they can be integers or strings. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-16 13:11 +0100
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 06:37 -0700
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 06:54 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:58 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 07:04 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 21:16 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 07:51 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 21:25 +0200
Re: Reverse elements in array, they can be integers or strings. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-16 21:41 +0100
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-16 16:51 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-17 11:14 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 03:04 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-17 12:40 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 06:04 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-17 21:47 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 15:06 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-18 00:57 +0200
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 17:10 -0700
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-18 13:16 +0200
Re: Reverse elements in array, they can be integers or strings. John Harris <niam@jghnorth.org.uk.invalid> - 2015-05-18 10:28 +0100
Re: Reverse elements in array, they can be integers or strings. Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-18 16:44 +0000
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-18 10:16 -0700
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-18 10:13 -0700
Re: Reverse elements in array, they can be integers or strings. John Harris <niam@jghnorth.org.uk.invalid> - 2015-05-18 19:42 +0100
Re: Reverse elements in array, they can be integers or strings. jonas.thornvall@gmail.com - 2015-05-17 02:58 -0700
Re: Reverse elements in array, they can be integers or strings. Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-16 22:41 +0000
Re: Reverse elements in array, they can be integers or strings. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-16 15:11 +0200
Re: Reverse elements in array, they can be integers or strings. John Harris <niam@jghnorth.org.uk.invalid> - 2015-05-17 11:27 +0100
csiph-web