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


Groups > comp.lang.javascript > #25926

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-17 16:10 +0000
Organization A noiseless patient Spider
Message-ID <m1rf17$2te$2@dont-email.me> (permalink)
References <fel14a5kmcg35jimb7hq4afq4tcnvfhohv@4ax.com>

Show all headers | View raw


On Fri, 17 Oct 2014 01:50:50 -0700, Ed Jay wrote:

> x_pos_array = [];
> x_pos_out = [];
> 
> Given that x_pos_array is not empty, e.g.,  x_pos_array[0] > 0
> 
> When x_pos_out[i] = x_pos_array[i];
> x_pos_out[i]) is undefined
> 
> But x_pos_out(no indexing) = x_pos_array[i];
> x_pos_out is defined as x_pos_array[i]
> 
> Why?

Sorry, but I'm having trouble following this.

eg:

var i, x1, x2;
x1 = [];
x2 = [];
x1.push( 1 );
for ( i = 0; i < x1.length; i++ ) x2[i] = x1[i];
console.log( "x1[0] = " + x1[0] +"; x2[0] = " + x2[0] );

Output is: "x1[0] = 1; x2[0] = 1"

So I can't really see what the problem is - can you offer code that 
demonstrates 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