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


Groups > comp.lang.javascript > #20129

'pushing' vs direct array assignment ?

From "Mel Smith" <med_cutout_syntel@aol.com>
Newsgroups comp.lang.javascript
Subject 'pushing' vs direct array assignment ?
Date 2013-06-03 13:59 -0600
Message-ID <b14atkFk8dnU1@mid.individual.net> (permalink)

Show all headers | View raw


Hi:

    I build an array in JS that can be from 9 elements thru to nearly 1500 
elements

    I also build a 2-property object to be placed in each of these elements:

    The object to be saved in the array is :

      nuobj = {vrbl1: "vrbl1value", vrbl2: "vrbl2value" }

      // to add this object to this (possibly very big) array should I use 
the 'push' method :
      anames.push(nuobj) ;

      // or should I use direct array assignment
      anames[anames.length] = nuobj ;

    or, is there another preferred way to do this quickly ?

Thank you.

-- 
Mel Smith

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


Thread

'pushing' vs direct array assignment ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-03 13:59 -0600
  Re: 'pushing' vs direct array assignment ? Scott Sauyet <scott.sauyet@gmail.com> - 2013-06-03 13:39 -0700
    Re: 'pushing' vs direct array assignment ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-03 14:46 -0600
    Re: 'pushing' vs direct array assignment ? Stefan Weiss <krewecherl@gmail.com> - 2013-06-04 02:07 +0200
      Re: 'pushing' vs direct array assignment ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-03 18:40 -0600
        Re: 'pushing' vs direct array assignment ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-03 20:38 -0600
        Re: 'pushing' vs direct array assignment ? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-06-04 09:11 -0600
          Re: 'pushing' vs direct array assignment ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-04 12:47 -0600
            Re: 'pushing' vs direct array assignment ? Stefan Weiss <krewecherl@gmail.com> - 2013-06-04 22:44 +0200
              Re: 'pushing' vs direct array assignment ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-04 16:02 -0600
            Re: 'pushing' vs direct array assignment ? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-06-04 20:24 -0600
              Re: 'pushing' vs direct array assignment ? Gregor Kofler <usenet@gregorkofler.com> - 2013-06-05 14:50 +0200
                Re: 'pushing' vs direct array assignment ? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-06-05 22:38 -0600
              Re: 'pushing' vs direct array assignment ? Tim Slattery <Slattery_T@bls.gov> - 2013-06-05 08:51 -0400
                OT: Accept-Encoding (was: 'pushing' vs direct array assignment ?) Christoph Becker <cmbecker69@gmx.de> - 2013-06-05 15:23 +0200
  Re: 'pushing' vs direct array assignment ? RobG <rgqld@iinet.net.au> - 2013-06-05 18:12 -0700
    Re: 'pushing' vs direct array assignment ? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-06 08:54 -0600

csiph-web