Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38090
| From | "R.Wieser" <address@not.available> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Compare the Triplets | Printing two values. |
| Date | 2020-01-19 10:47 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <r018j9$3dv$1@gioia.aioe.org> (permalink) |
| References | <83a2fe4f-4564-4943-9515-b9bfc09b686a@googlegroups.com> |
manish,
I overlooked the below
> for (let i = 0; i < 4; i ++) {
> points=[];
> pointsArray=[];
Clearing the arrays /inside/ the loop means that if something is returned it
will only be the /last/ comparision result ...
To be honest, it looks like you slapped a "for" loop around something that
worked for a single comparision (with a "return" at the bottom of it), and
expected it to keep working.
Alas, computers do exactly what you tell them to do, instead of doing what
you ment. :-)
Suggestion: When you have trouble with a program have it print the
intermediate results. And in the case of loops print the loopcounter too.
It allows you to track what the code is doing and (hopefully) see where it
goes wrong (for starters, that your loop isn't looping at all)
Regards,
Rudy Wieser
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Compare the Triplets | Printing two values. manish pamnani <manishpamnani169@gmail.com> - 2020-01-19 00:05 -0800
Re: Compare the Triplets | Printing two values. "R.Wieser" <address@not.available> - 2020-01-19 10:08 +0100
Re: Compare the Triplets | Printing two values. manish pamnani <manishpamnani169@gmail.com> - 2020-01-19 09:08 -0800
Re: Compare the Triplets | Printing two values. manish pamnani <manishpamnani169@gmail.com> - 2020-01-19 09:09 -0800
Re: Compare the Triplets | Printing two values. "R.Wieser" <address@not.available> - 2020-01-19 19:10 +0100
Re: Compare the Triplets | Printing two values. Julio Di Egidio <julio@diegidio.name> - 2020-01-19 09:42 -0800
Re: Compare the Triplets | Printing two values. "R.Wieser" <address@not.available> - 2020-01-19 10:47 +0100
Re: Compare the Triplets | Printing two values. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-19 13:03 -0800
Re: Compare the Triplets | Printing two values. Julio Di Egidio <julio@diegidio.name> - 2020-01-19 14:05 -0800
Re: Compare the Triplets | Printing two values. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-19 15:21 -0800
Re: Compare the Triplets | Printing two values. Julio Di Egidio <julio@diegidio.name> - 2020-01-19 15:39 -0800
csiph-web