Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32883
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Understanding someone's code |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <WumdnYlb48xrFUHFnZ2dnUU7-K_NnZ2d@westnet.com.au> <XnsA7487B53461A9eejj99@194.109.6.166> <obir0r$p3e$1@softins.softins.co.uk> <XnsA7488E8B9765eejj99@194.109.6.166> <obj240$rdp$1@softins.softins.co.uk> |
| Date | 2017-03-30 19:07 +0200 |
| Message-ID | <XnsA748C2851D123eejj99@194.109.6.166> (permalink) |
tony@mountifield.org (Tony Mountifield) wrote on 30 Mar 2017 in
comp.lang.javascript:
>> After:
>>
>> F = 7;
>> a = 0;
>> if (a) {
>> F = a;
>> document.getElementById("pageNumber").value = a;
>> }
>>
>> F will be 7,
>>
>> while after:
>>
>> F = 7;
>> a = 0;
>> F = (F = a) && (document.getElementById("pageNumber").value = a);
>>
>> F will be 0;
>
> What's an initial assignment to F got to do with it? That wasn't in the
> original example. Nor was your outer assignment to F in the third line.
That does not matter, it shows both codes are not the same.
> Let's consider the original code piece by piece:
>
> b.getPageInView && (a = b.getPageInView()) && (F = a,
> document.getElementById("pageNumber").value = a);
[..]
Let's not
I am not responding to the exact code,
I am showing both codes are not the same.
That they get the same result in a specific instance,
where the value of F is unimportant, has nothing to do with it,
as is this nonsense:
a = 3;
and
a = 4;
are exactly the same if you do not use the value of a.
>> > If you believe
>> > it to be a wrong interpretation of the original code, why not provide
>> > a better one
>>
>> This is not a church,
>> faith does not come into coding,
>> faith being nonsense anyway.
>
> s/believe/consider/ or s/believe/think/. I was using "believe" in one of
> those meanings, nothing to do with faith.
You used, I expected, 'believe' to show you trust your analysis without
testing, which is dangerous in your own code, but undefentable if you try to
get people to understand a certain manner of coding.
> Sounds like you have an axe to grind regarding the latter.
You must be a good listener to sounds. ;-)
>> > , instead of the unrelated and simple example below?
>>
>> I try to teach to the best of my knowledge,
>> not take over the coding,
>> this NG not being a helpdesk.
>
> That's true, it isn't. But if you volunteer to respond, it doesn't help
> if you don't answer the question asked.
"if you volunteer to help"?
Nonsense, this is not a helpdesk,
and I don't "volunteer",
I respond because I want to respond.
I read in the somewhat convoluted code question the misunderstanding
of the both peculear and usefull working the "&&" binary operator.
And my response was to the group, not just to the OP.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Understanding someone's code Andrew Poulos <ap_prog@hotmail.com> - 2017-03-30 15:26 +1100
Re: Understanding someone's code Andrew Poulos <ap_prog@hotmail.com> - 2017-03-30 18:48 +1100
Re: Understanding someone's code "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-03-30 12:07 +0200
Re: Understanding someone's code tony@mountifield.org (Tony Mountifield) - 2017-03-30 11:43 +0000
Re: Understanding someone's code "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-03-30 14:00 +0200
Re: Understanding someone's code tony@mountifield.org (Tony Mountifield) - 2017-03-30 13:44 +0000
Re: Understanding someone's code "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-03-30 19:07 +0200
Re: Understanding someone's code JJ <jj4public@vfemail.net> - 2017-03-30 18:58 +0700
Re: Understanding someone's code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-03-30 18:13 +0200
Re: Understanding someone's code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-03-30 18:13 +0200
Re: Understanding someone's code John G Harris <niam@jghnorth.org.uk.invalid> - 2017-03-31 10:30 +0100
Re: Understanding someone's code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-02 14:41 +0200
Re: Understanding someone's code John G Harris <niam@jghnorth.org.uk.invalid> - 2017-04-02 19:05 +0100
Re: Understanding someone's code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-10 05:00 +0200
Re: Understanding someone's code John G Harris <niam@jghnorth.org.uk.invalid> - 2017-04-10 10:03 +0100
csiph-web