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


Groups > comp.lang.javascript > #36399

Re: Javascript "object creation" and object oriented programming

From "R.Wieser" <address@not.available>
Newsgroups comp.lang.javascript
Subject Re: Javascript "object creation" and object oriented programming
Date 2019-04-24 12:34 +0200
Organization Aioe.org NNTP Server
Message-ID <q9pe47$m78$1@gioia.aioe.org> (permalink)
References <5a2b4e29-7d14-4cd3-8759-a77083b987cb@googlegroups.com>

Show all headers | View raw


Jonas,

> So i have a hard time to grip howto actually make the objects to store 
> data.

It looks to me you are mixing up objects and arrays.

The below website shows the usage of arrays withoud using actual objects or 
functions for it:

https://eloquentjavascript.net/04_data.html

This one shows what I call an /object/ (as in: having properties and/or 
methods) and how to store varaibles and array into it.

https://stackoverflow.com/questions/14652504/performance-using-array-in-the-object-namespace-vs-local-array

Also, your "function newCollection(m)" returns a pointer to the function 
itself(?), not to the array you created -which will be discarded (it 
disappears) as soon as you leave that function.  In other words: you should 
be using "return extSynth();".

But that creates its own problem, as you will than return the /whole/ array 
(with all the "objects" in it), not just the one you just created.

Yeah, it looks like you mixed up a few things there.  Have you ever tried to 
access (read, write, read - in that order) that returned object ?   And ? 
What happened ? :-)

Regards,
Rudy Wieser

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


Thread

Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-23 23:50 -0700
  Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 01:02 -0700
  Re: Javascript "object creation" and object oriented programming "R.Wieser" <address@not.available> - 2019-04-24 12:34 +0200
    Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 05:41 -0700
      Re: Javascript "object creation" and object oriented programming "R.Wieser" <address@not.available> - 2019-04-24 18:06 +0200
  Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 06:24 -0700
    Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 07:00 -0700
  Re: Javascript "object creation" and object oriented programming John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-24 17:39 +0100
    Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 11:01 -0700
      Re: Javascript "object creation" and object oriented programming John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-25 18:08 +0100
        Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-25 10:14 -0700
    Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 11:11 -0700
      Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-24 13:50 -0700
        Re: Javascript "object creation" and object oriented programming jonas.thornvall@gmail.com - 2019-04-25 01:01 -0700
      Re: Javascript "object creation" and object oriented programming John G Harris <niam@jghnorth.org.uk.invalid> - 2019-04-25 18:12 +0100

csiph-web