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


Groups > comp.lang.javascript > #25937

Re: Why: X[i] = x[i] = undefined when x[i] defined?

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Why: X[i] = x[i] = undefined when x[i] defined?
Date 2014-10-18 22:17 +0000
Organization A noiseless patient Spider
Message-ID <m1uots$vl2$1@dont-email.me> (permalink)
References <fel14a5kmcg35jimb7hq4afq4tcnvfhohv@4ax.com> <m1rf17$2te$2@dont-email.me> <95g24apb19udm64v45cehj91b6nj7uo3jb@4ax.com>

Show all headers | View raw


On Fri, 17 Oct 2014 09:29:54 -0700, Ed Jay wrote:

>>So I can't really see what the problem is - can you offer code that
>>demonstrates it?
> 
> Thanks for the response. I can't see it either. :-)
> 
> I create a div for hit zones over a canvas if some conditions are met.
> Code - .....

By inspection your code will not run, it seems to be missing a statement 
terminator, have an imbalance of "{" vs "}", and at least one logic test 
is not correctly enclosed in "()". Additionally some guesswork is 
required to determine where comments terminate and new lines begin.

Hence it is impossible for your code to demonstrate the problem case, 
moreover I suspect to do so it would need some minimal html wrapper to go 
with it in order to provide a dom context in which it operates.

We can not magically deduce the part(s) of the problem that you fail to 
supply us with when explaining what isn't working.

In future, when posting a problem, please post the minimum sufficient 
code (including the html document body if needed) that enables the 
problem being described to be reproduced in a browser or other javascript 
interpreter. This is a generic issue that applies to any request for help 
with programming, regardless of language, you should endeavour to post 
minimum example code that the reader can run to reproduce the actual 
problem you are trying to solve.

The problem you appear to be asking about (see the subject line) is that 
you are experiencing a case where assigning values to array s, and then 
assigning array t to be equal to array s, t[n] is undefined when s[n] is 
defined.

Nothing in the code you posted demonstrates this, at least in part 
because the code isn't executable due to the above mentioned errors.

1) Develop code (or possibly in your case an html document with embedded 
script element) that demonstrates the exact problem.

2) Cut the document down to the minimum code that shows the problem.

3) Use /* ..... */ style comments so it is clear where comments end, 
especially when posting code to usenet where line wrapping may not be 
preserved.[1]

4) Post the whole document here if fairly short (eg less than 30 lines or 
so) or if larger post a link to it on a web server.

5) Remember step 2, it really is important. The more code that is 
irrelevant to the problem that we need to trawl through and try and 
understand the more likely we are to lose interest. We are not going to 
do step 2 for you, you need to do that as part of the we fix your code 
deal.

[1] I've been using usenet and similar for 25+ years, and I still haven't 
worked out a consistent and guaranteed way to preserve line breaks in 
code postings[2] that allows for the vagaries of all the different 
clients and the way they process received text and quote it. Don't even 
bother trying!

[2] Apart from posting the source somewhere and posting a link to it in 
the message, which upsets some purists, but which is sometimes the only 
way to do it.

-- 
Denis McMahon, denismfmcmahon@gmail.com

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


Thread

Why: X[i] = x[i] = undefined when x[i] defined? Ed Jay <edMbj@aes-intl.com> - 2014-10-17 01:50 -0700
  Re: Why: X[i] = x[i] = undefined when x[i] defined? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-17 16:10 +0000
    Re: Why: X[i] = x[i] = undefined when x[i] defined? Ed Jay <edMbj@aes-intl.com> - 2014-10-17 09:29 -0700
      Re: Why: X[i] = x[i] = undefined when x[i] defined? Ed Jay <edMbj@aes-intl.com> - 2014-10-17 10:52 -0700
        Re: Why: X[i] = x[i] = undefined when x[i] defined? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-17 21:29 +0200
          Re: Why: X[i] = x[i] = undefined when x[i] defined? Ed Jay <edMbj@aes-intl.com> - 2014-10-17 12:32 -0700
            Re: Why: X[i] = x[i] = undefined when x[i] defined? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-17 21:51 +0200
              Re: Why: X[i] = x[i] = undefined when x[i] defined? Ed Jay <edMbj@aes-intl.com> - 2014-10-17 13:21 -0700
              Re: Why: X[i] = x[i] = undefined when x[i] defined? Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> - 2014-10-18 21:38 +0100
          Re: Why: X[i] = x[i] = undefined when x[i] defined? John Harris <niam@jghnorth.org.uk.invalid> - 2014-10-18 10:36 +0100
      Re: Why: X[i] = x[i] = undefined when x[i] defined? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-18 22:17 +0000
        Re: Why: X[i] = x[i] = undefined when x[i] defined? Dr J R Stockton <reply1400@merlyn.demon.co.uk.invalid> - 2014-10-19 22:54 +0100

csiph-web