Subj : Re: Learning arrays
To : echicken
From : Mortifis
Date : Wed Jul 17 2019 12:43 pm
> Re: Learning arrays
> By: Mortifis to All on Wed Jul 17 2019 11:09:38
> Mo> var has_dup = false;
> This is not an array, so later when you do this:
> Mo> has_dup[i] = true;
> you're setting property [i] on a boolean to 'true'. Interestingly this
> doesn't generate an
> error, but it also doesn't store that property/value.
> Instead of this:
> var has_dup = false;
> you probably want this:
> var has_dup = [];
> Note that you're also declaring 'dups' twice:
> Mo> var dups=0;
> Mo> var dups;
> So by the time your script gets down to business, 'dups' is undefined and
> your 'dups++'
> won't work. (Just remove that 'var dups;' line.)
> Your nested for loop could be sped up a little bit:
> for (var n = i + 1; n <= lastuser; n++) {
> You've already dupe-checked all users up to i, and you want to start with
> users beginning at
> i + 1. This would also remove the need for the 'if(u.number == d.number)
> continue;' check.
yes that sped things up and also forced a deletion of dups = dups/2; :-)
> I could go on with some other suggestions, but I'll stop here for now.
I am open to suggestions but I think I have a handle on the has_dup Array,
thank you :)
My teachers always said "You can't make a living looking out a window!", they
were wrong, I drive truck :-P
---
� Synchronet � AlleyCat! BBS -
http://alleycat.synchro.net:81