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


Groups > comp.lang.javascript > #23540

Re: arr.push(obj);

Newsgroups comp.lang.javascript
Date 2014-03-11 15:43 -0700
References (4 earlier) <fbd15953-edfd-4456-b4c8-7b31417ecd24@googlegroups.com> <XnsA2EDA6E3485F7eejj99@194.109.133.133> <253eca00-abda-47da-8388-8a621f36fffd@googlegroups.com> <59661127-bbd4-4eb5-b824-1b4074ccfbd9@googlegroups.com> <531f548b$0$6672$9b4e6d93@newsspool2.arcor-online.net>
Message-ID <c8b312b8-eef9-4f65-abf2-c2725a2d4dc9@googlegroups.com> (permalink)
Subject Re: arr.push(obj);
From jonas.thornvall@gmail.com

Show all headers | View raw


Den tisdagen den 11:e mars 2014 kl. 19:23:10 UTC+1 skrev Christoph Michael Becker:
> jonas.thornvall@gmail.com wrote:
> 
> 
> 
> > I do not need length or any attribute of array it implicit in my
> 
> > code, but i do need objects or multidimensional arrays that can store
> 
> > strings, ***at negative indexes.***
> 
> > 
> 
> > I showed you that the array will store values at negative indexes.
> 
> 
> 
> No.  You have shown that an array can store values in properties whose
> 
> name resembles a negative number.
> 
> 
> 
> >                                                                     So
> 
> > my question remains can i set also objects not only values at the
> 
> > negative indexes of an array.
> 
> 
> 
> As there are no negative indexes[1], you can't.  However, you can store
> 
> arbitrary values (for instance, object references) in properties.
> 
> 
> 
> > And how do i achieve that.
> 
> 
> 
>   a[-1] = {};

I try to get the gist of what you saying but for me it is all very confusing.
Do you mean something like this?

var arr = new Array();
for (var i = -500; i <= +500; i ++ )
{
arr[i] =
   {
      count : i,
      fcolor : 'black',
      rheight : 100,
      rwidth : 100,
      rcolor : 'white'
   }
} 

Best regards JT


> 
> 
> 
> [1] <http://www.ecma-international.org/ecma-262/5.1/#sec-15.4>
> 
> 
> 
> -- 
> 
> Christoph M. Becker

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


Thread

arr.push(obj); jonas.thornvall@gmail.com - 2014-03-10 17:38 -0700
  Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-10 20:19 -0700
    Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-10 20:28 -0700
      Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-10 21:19 -0700
        Re: arr.push(obj); Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-11 06:59 -0300
          Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-11 16:02 +0100
            Re: arr.push(obj); Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-11 16:22 +0000
            Re: arr.push(obj); Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-11 13:32 -0300
  Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-11 10:21 +0100
    Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 03:53 -0700
      Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-11 14:03 +0100
        Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 07:45 -0700
          Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-11 16:24 +0100
            Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 10:40 -0700
              Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 10:51 -0700
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-11 19:23 +0100
                Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 15:33 -0700
                Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-12 00:37 +0100
                Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 16:46 -0700
                Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-12 01:05 +0100
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 01:40 +0100
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 00:48 +0100
                Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 15:43 -0700
                Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 16:18 -0700
                Re: arr.push(obj); "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-12 00:39 +0100
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 00:52 +0100
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 00:49 +0100
                Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 17:16 -0700
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 02:07 +0100
                Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 18:13 -0700
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-13 02:25 +0100
                Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-13 11:03 +0100
                Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-12 07:46 -0700
                Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-12 01:27 +0100
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 01:44 +0100
          Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-11 16:26 +0100
            Re: arr.push(obj); Carlos Pedro <carlospedr@gmail.com> - 2014-03-11 09:21 -0700
            Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-11 18:01 +0100
              Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-11 19:15 +0100
                Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-11 20:32 +0100
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 01:01 +0100
                Re: arr.push(obj); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-12 04:08 +0100
                Re: arr.push(obj); Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-12 18:00 +0100
  Re: arr.push(obj); Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-11 06:24 -0300
    Re: arr.push(obj); jonas.thornvall@gmail.com - 2014-03-11 03:47 -0700
      Re: arr.push(obj); Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-11 15:19 +0000

csiph-web