Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #27060 > unrolled thread
| Started by | jonas.thornvall@gmail.com |
|---|---|
| First post | 2015-03-17 01:55 -0700 |
| Last post | 2015-03-17 01:55 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.javascript
Strings vs Arrays and their use. jonas.thornvall@gmail.com - 2015-03-17 01:55 -0700
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-03-17 01:55 -0700 |
| Subject | Strings vs Arrays and their use. |
| Message-ID | <73bece66-ea4e-4d0f-8370-cae9873bacba@googlegroups.com> |
What is the main reason doing array manipulations versus string manipulations, are there less operations doing array manipulations?
When reading code i can think that there is a readability in doing string manipulations using variables rather than assigning the index of an array.
And also i wonder should one alway try do it directly between arrays?
for (i=0;i<length;i++){
sum=arrOne[i]+arrTwo[i]+remainder;
if (sum>=base) { sum=sum-base; remainder=1;} else {remainder=0;}
result[i]=sum;
}
Or this
for (i=0;i<length;i++){
result[i]=arrOne[i]+arrTwo[i]+remainder;
if (result[i]>=base) { result[i]=result[i]-base; remainder=1;}
else {remainder=0;}
}
I prefer reading the above code, but maybe it use more operations?
Back to top | Article view | comp.lang.javascript
csiph-web