Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Overflow, integers and strings Date: Fri, 01 May 2015 22:42:23 +0200 Organization: PointedEars Software (PES) Lines: 30 Message-ID: <1997740.h7VUlrh2Em@PointedEars.de> References: <09495c64-e320-46ca-a6d9-b9f0427c7efd@googlegroups.com> <66061bf2-9092-42a5-918e-5a039a53db20@googlegroups.com> <6ca07e69-1694-49c1-93eb-748c44d8ab68@googlegroups.com> <871tj08vrb.fsf@bsb.me.uk> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1430513094 1902 eJwNyMkBwCAMA7CVEoINjJNz/xFaPQWjMs8muDEYV82agDzJXHB/mXqDXWM31Oue6O6/iyZYHzwFEkE= (1 May 2015 20:44:54 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Fri, 1 May 2015 20:44:54 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwQkBwDAIA0BL5QktchgB/xJ2BwuJvh4Ix2KtskQruNPgG2Rdt2wztIozxlzOrPCguFyjXg0q3mf58ANh6hWU Cancel-Lock: sha1:No1Sbo5EpxgtFPyehox2V/tWZw8= X-NNTP-Posting-Host: eJwNx8EBADEEBMCWCMspB6H/EnLzG4ixtavBFIuNZp2kkFNEX6VDz2WeGK1/spBk7zx0QyL9ARYlEO0= Xref: csiph.com comp.lang.javascript:27466 Christoph M. Becker wrote: > Evertjan. wrote: >> 'this' works: > > Not necessarily: > > function test() { > > var a = [1], b = [2]; > > function arraySwap(x,y) { > var tempArrName = this[y]; > this[y] = this[x]; > this[x] = tempArrName; > } > > console.log(a, b); > arraySwap(a, b); > console.log(a, b); > } Also, “this” is undefined in arraySwap() if that function is called in strict mode. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.