Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.javascript Subject: Re: javascript loop problem Date: Wed, 01 Apr 2015 14:42:43 +0200 Organization: solani.org Lines: 32 Message-ID: References: <8f8b8bbd-fed1-4871-b3e4-e0b96abd3692@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: solani.org 1427892155 603 eJwNysERwDAIA7CVcMBA1ql73n+EVm8xG62pZhdNI44KQCk991rxh9lepu18VAlEMUZ49+wH/JIP2g== (1 Apr 2015 12:42:35 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Wed, 1 Apr 2015 12:42:35 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 X-User-ID: eJwNyskBACAIA7CVRKTUcZRj/xE075hCEL5gWNbWk+PkDjgjq0UJzRPUhgNSwyuJkl1X4v74ACJtEag= In-Reply-To: <8f8b8bbd-fed1-4871-b3e4-e0b96abd3692@googlegroups.com> Cancel-Lock: sha1:/YfcKnTSTFC2sJqq0loTEnwe9FU= X-NNTP-Posting-Host: eJwNykkBwDAIBEBLLHfkQCj+JaTzHhOH31A3V1vbU4O6Y9zJ04fE99PUXSQQtIPggVT/b0jpASgfEUc= Xref: csiph.com comp.lang.javascript:27154 chrisb@ctlsoft.com wrote: > little script which adds map markers to the appropriate locations with a label. > The array 'myaddresses' contain the locations to mark on the map and the numbers to put on the labels. > Works fine for the location bit, but the labels all show the last count (35). > > So the line labelContent: myaddresses[x][1] always seems to return the final array element for some reason. When this expression is evaluated, x === myaddresses.length-1. >