Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #14733
| From | RoLaAus <robert@theaustinfamily.us> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: JS newbie and Array newbie |
| Date | 2012-06-27 16:56 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <29b263a4-d7d2-4ff3-bd97-bab348218e45@googlegroups.com> (permalink) |
| References | <d1e9e795-70bd-498d-8e0d-48511a59cf37@googlegroups.com> <jsdl56$5rr$1@news.albasani.net> |
On Tuesday, June 26, 2012 5:37:03 PM UTC-7, Stefan Weiss wrote:
> On 2012-06-27 02:16, robert@theaustinfamily.us wrote:
> > Here is what I have - and isn't working for whatever reason;
> >
> > function myPlanet(inPosX, inPosY, inName) {
> > this.posX = inPosX;
> > this.posY = inPosY;
> > this.myName = inName;
> > }
> > this is *supposed* to create a new "planet" object (called myPlanet)
> >
> > and I call this function with the following code
> > var objPlanets = new myPlanet(myX, myY, ****);
> >
> > ** my "planet name" - for the time being, I was wanting to use the
> > combination of myX and myY and no matter what I try to place into the
> > name variable, I can't get it to work!
>
> I don't understand your problem. What you posted should work fine:
>
> function myPlanet(inPosX, inPosY, inName) {
> this.posX = inPosX;
> this.posY = inPosY;
> this.myName = inName;
> }
>
> var objPlanets = new myPlanet(23, 34, "the name");
>
> alert(objPlanets.posX);
> alert(objPlanets.posY);
> alert(objPlanets.myName);
>
> Does this not show three alerts for the three arguments you passed to
> the myPlanet constructor?
>
> And what does this have to do with arrays?
>
> - stefan
Okay, well, I knew it must have been something stupid, and true enough, it was (sort 0f).
I was trying to debug this project by using the Alert() function, but mine went like this
alert(objPalnet(myName));
Now, as for the array part, I am trying (as should be obvious) trying to build a list of several planets, and will need a way to find specific details about each individual one, normally I would use database tools, creating record sets and be able to do whatever I want with the RecordSet object, but as I said, I'm branching out here and trying to learn something new.
This is a completely separate issue, and would be more than happy to post in a new thread if necessary, but I do already have two people keeping up with this thread with responses, so I figure I might as well follow up this roadblock with another, separate but related issue.
Given that I have a list of multiple planets, how would I go about retrieving say, the population of the planet named 'Earth'?
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JS newbie and Array newbie robert@theaustinfamily.us - 2012-06-26 17:16 -0700
Re: JS newbie and Array newbie Stefan Weiss <krewecherl@gmail.com> - 2012-06-27 02:37 +0200
Re: JS newbie and Array newbie RoLaAus <robert@theaustinfamily.us> - 2012-06-27 16:56 -0700
Re: JS newbie and Array newbie Gregor Kofler <usenet@gregorkofler.com> - 2012-06-27 11:00 +0200
Re: JS newbie and Array newbie RoLaAus <robert@theaustinfamily.us> - 2012-06-27 17:01 -0700
Re: JS newbie and Array newbie "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-06-29 16:45 -0700
csiph-web