Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38096
| From | "R.Wieser" <address@not.available> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Compare the Triplets | Printing two values. |
| Date | 2020-01-19 19:10 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <r0262k$csu$1@gioia.aioe.org> (permalink) |
| References | <83a2fe4f-4564-4943-9515-b9bfc09b686a@googlegroups.com> <r016am$1p6l$1@gioia.aioe.org> <3adfc7da-2433-420b-99a2-150eb73771a4@googlegroups.com> <a681267b-3ad5-481d-8394-d2cfbc25817b@googlegroups.com> |
manish,
>> Firstly, I removed points[i] as i was not using it.
Nope, you didn't. Both arrays are still created in your code.
>> Secondly, I made two different integers for alice and Bob
Thats one good way to do it. :-)
>> pushed the value 1(if the value is greater)
The phrase you where looking for is "incremented by one", not "pushed the
value 1" - especially when you already used the word "push" to indicate
adding elements to an array (and thus might cause confusion)
> and 0(if both values are equal) .
Not in the code you've posted (you commented that out).
And as such you can remove the whole "if (a[i] === b[i]) { }" block, as it
doesn't do anything.
>> The program looks something like this:
...
>> The program still prints the value seperately, not in one single array.
Hmmm... I can interpret that in different ways. Yes, you have printed the
"alice" and "bob" scores in two seperate "console.log()" lines. But the
problem is that you also get three groups of it.
The cause ? Your "for" loop (still) starts and ends at the wrong places.
Hint: Make "alice" win all of the games. What result does your program show
? If anything, it /should/ show the results 1, 2 and 3 for alice, and 0, 0,
0 for bob. But it doesn't. Can you see why ?
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