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


Groups > comp.lang.javascript > #36470

Re: Objects what are they.

From "R.Wieser" <address@not.available>
Newsgroups comp.lang.javascript
Subject Re: Objects what are they.
Date 2019-04-28 18:11 +0200
Organization Aioe.org NNTP Server
Message-ID <qa4jc3$13h4$1@gioia.aioe.org> (permalink)
References (1 earlier) <1e0e684f-a0c8-40d9-b43d-9129a7d4b99d@googlegroups.com> <c0s3cep7c7lug1b76jko8g008c9t779crk@4ax.com> <aee65943-9a1b-4201-b3ec-ca6a4422580c@googlegroups.com> <jnk5cehnidqfu0q591oau3ptqmq4bngcg2@4ax.com> <d4cece83-66ea-48d9-8ba5-f6c0a4fcb579@googlegroups.com>

Show all headers | View raw


Jonas,

> The above is fully clear to me, but it is stringed together
> from parts,

Those "parts" as you call it are the objects. :-)

> but maybe that is just how you do it in Javascript?

How you /can/ do it.    You can, if you want, still do it with arrays too. 
After all, you do not seem to need any (user defined!) functions on any of 
those objects.    As such you can therefore currently still use the names 
"object" and "array" interchangably.

> Is this also the way others would implemented something
> like followin pseudo code "structure" in Javascript?

Definitily not.   For starters, you have "Instrumentindex,Instrumentname" 
twice in there.  Also, none of the objects (the left-most names) are arrays, 
they are objects (1).  They /contain/ arrays (the right-most names).

Furthermore, the XxxxIndex thingies there are properties of the arrays (2), 
and do not need to be seperatily stored.

(1) than again, you are still looking at those objects as if they are arrays 
...   Whis, in this particular case, they well might be. :-)

Your "Obj Synth" is special: it currently does not contain anything else 
than an array called "Bank".  Though it could also contain another property 
with the name of the play.  "Mozards fitfth" for instance.

Your 'Bank" object contains two properties: One is its name, and the second 
an array with "Instrument"s

Your "Instrument" object contains two properties: One is its name, and the 
second an array with "Note"s

Your "Note" object (currently) contains a single property, the notes name.

(2) you do not need an index to be able to add or loop thru an array. 
Though I can imagine that its handy when looping thru all the notes.  (for 
example, to add new element to an array you can use "{arrayname}.push(new 
item)")

> Obj. Synth:
>    //  Prop.
>    Synth[](InstrumentIndex,InstrumentName,(Bank))
> [Snip]

Nope.

Obj. "Synth":
  //Prop #1 - "Banks", an array holding zero or more "Bank" objects

 Obj "Bank":
  //Prop #1 - "Name", a string
  //Prop #2 - "Instruments", an array holding zero or more "Instrument" 
objects

 Obj "Instrument":
  //Prop #1 - "Name", a string
  //Prop #2 - "Notes", an array holding zero or more "Note" objects

  Obj "Note":
  //Prop #1 - "Name" - a string indicating a certain note (or 
sub-instrument).

> One would like something like a structure explanation for the "object?".

John G gave you one.  The above is another. But I guess you could also put 
it down like the below :

 Synth[Banks[BankName,Instruments[InstrumentName,Notes[NoteName]]]]

Hope that helps.

Regards,
Rudy Wieser

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


Thread

Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 02:16 -0700
  Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 02:40 -0700
  Re: Objects what are they. groovee@cyberdude.com - 2019-04-25 09:12 -0700
    Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-25 18:37 +0100
      Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 23:41 -0700
        Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-25 23:56 -0700
          Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 00:00 -0700
        Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-26 10:45 +0100
          Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 04:37 -0700
            Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-26 19:41 +0100
              Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-26 21:11 +0200
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 13:23 -0700
                Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-26 23:32 +0200
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 15:11 -0700
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 15:24 -0700
                Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-27 11:52 +0200
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 11:17 +0100
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-27 05:00 -0700
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-27 05:06 -0700
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 11:08 +0100
          Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-28 05:03 -0700
            Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-28 18:11 +0200
              Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 03:43 -0700
                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 14:11 +0200
                Re: Objects what are they. John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-29 11:15 -0400
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 08:41 -0700
                Re: Objects what are they. John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-29 15:16 -0400
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 15:56 -0700
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 16:08 -0700
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 16:30 -0700
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 09:44 -0700
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 08:31 -0700
        Re: Objects what are they. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-04-26 13:48 +0200
      Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 00:25 -0700
        Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 00:30 -0700
        Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-26 01:06 -0700
      Re: Objects what are they. groovee@cyberdude.com - 2019-04-26 07:41 -0700
        Re: Objects what are they. Jon Ribbens <jon+usenet@unequivocal.eu> - 2019-04-26 15:39 +0000
          Re: Objects what are they. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-04-26 23:23 +0200
            Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 11:25 +0100
              Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 04:10 -0700
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 04:17 -0700
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 14:39 +0100
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 10:16 -0700
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-28 10:53 +0100
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 07:08 -0700
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 11:03 +0100
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-27 14:43 +0100
        Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-26 19:36 +0100
          Re: Objects what are they. groovee@cyberdude.com - 2019-04-28 08:53 -0700
            Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-29 10:35 +0100
        Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-27 17:45 +0200
          Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-27 10:19 -0700
            Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-27 20:57 +0200
              Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 06:53 -0700
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-29 15:08 +0100
                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 19:21 +0200
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-29 20:06 +0100
                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 23:09 +0200
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 10:39 +0100
                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-30 14:06 +0200
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-30 05:26 -0700
                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-30 19:14 +0200
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-30 12:07 -0700
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-05-01 14:29 +0100
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-05-01 07:52 -0700
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-05-01 18:34 +0100
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 18:27 +0100
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-30 18:22 +0100
                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-30 22:25 +0200
                Re: Objects what are they. John G Harris <niam@jghnorth.org.uk.invalid> - 2019-05-01 15:15 +0100
                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 18:31 +0200
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-29 09:42 -0700
                Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-29 19:42 +0200
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-29 17:35 -0700
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 00:18 -0700
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 06:00 -0700
                Re: Objects what are they. Julio Di Egidio <julio@diegidio.name> - 2019-04-30 06:16 -0700
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 06:38 -0700
                Re: Objects what are they. jonas.thornvall@gmail.com - 2019-04-30 06:21 -0700
          Re: Objects what are they. groovee@cyberdude.com - 2019-04-28 08:43 -0700
            Re: Objects what are they. "R.Wieser" <address@not.available> - 2019-04-28 19:02 +0200
    Re: Objects what are they. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-04-26 23:07 +0200

csiph-web