Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Maik Koenig Newsgroups: comp.lang.javascript Subject: Re: Trying to create array of object literals Date: Thu, 12 Apr 2018 21:47:49 +0200 Lines: 45 Message-ID: References: <2ea2803e-c39d-40e0-b8ed-136c3dc9b4e0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net YQI7hgXGYLa+HvJAc4+RBQ4YqQSdlkUQ8qU0Hl7P1JbtxWAPdd Cancel-Lock: sha1:LEu3NOuDWSSZFLWwZl16FPcFaHQ= User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 Hamster/2.1.0.1538 In-Reply-To: <2ea2803e-c39d-40e0-b8ed-136c3dc9b4e0@googlegroups.com> Xref: csiph.com comp.lang.javascript:34814 Am 12.04.2018 um 21:17 schrieb bit-naughty@hotmail.com: > I have this in my code: > > var point = { x:0, y:0 }; > > > Now I want to build an array of the "point" array literal (ie. > storing 3 points): > > var projectedpoly = point[3]; > > So that I can do this: > > document.write(projectedpoly[i].x); > > But the "var projectedpoly = point[3]; " statement is not working, > far as I can see - what must I do? var point = [{ x:0, y:0 }, { x:1, y:1 }, { x:2, y:2 }, { x:3, y:3 }]; console.log (point[2].x); // 2 Greetz, MK -- Kopp-Verlag-Gläubige, Religionsdeppen, rechte Vollidioten und ähnlicher Bio-Abfall werden ohne Hinweis ignoriert! - Sei eine Möwe: Scheiss drauf -