Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #9018

Weird Code: Check My Reading of It

From Gene Wirchenko <genew@ocis.net>
Newsgroups comp.lang.javascript
Subject Weird Code: Check My Reading of It
Date 2011-12-08 20:46 -0800
Organization A noiseless patient Spider
Message-ID <k243e7ltslnc4op0hd6api696jep2qja0j@4ax.com> (permalink)

Show all headers | View raw


Dear JavaScripters:

     The text I am following has a oddball piece of code.  Please
check that I am reading it right.

***** Start of Oddball Code *****
function writeDocument(n,s) {
 var doc=parent.frames[1].frames[n].location = s
}
***** End of Oddball Code *****

     As I read this, the location for a frame will be set to s.  doc,
a local variable, will be set to s as well.  But this is all there is
to the function, and therefore, the
          var doc=
part of the body serves no useful purpose.

     Am I correct in my reading?

     Sometimes, I think that errors like this in a text are horrible;
other times, I think it is good exercise.  I am undecided here.  (I
did not know about JavaScript's multiple assignment, so I suppose that
I have learned something.)

Sincerely,

Gene Wirchenko

Back to comp.lang.javascript | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Weird Code: Check My Reading of It Gene Wirchenko <genew@ocis.net> - 2011-12-08 20:46 -0800
  Re: Weird Code: Check My Reading of It David Mark <dmark.cinsoft@gmail.com> - 2011-12-08 21:34 -0800
    Re: Weird Code: Check My Reading of It Norman Peelman <npeelmandog@cfl.rr.com> - 2011-12-09 06:55 -0500
      Re: Weird Code: Check My Reading of It David Mark <dmark.cinsoft@gmail.com> - 2011-12-09 12:07 -0800
      Re: Weird Code: Check My Reading of It Gene Wirchenko <genew@ocis.net> - 2011-12-09 10:09 -0800
  Re: Weird Code: Check My Reading of It Dr J R Stockton <reply1149@merlyn.demon.co.uk> - 2011-12-10 20:37 +0000

csiph-web