Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Overflow, integers and strings Date: Fri, 01 May 2015 10:58:16 +0100 Organization: A noiseless patient Spider Lines: 22 Message-ID: <871tj08vrb.fsf@bsb.me.uk> References: <09495c64-e320-46ca-a6d9-b9f0427c7efd@googlegroups.com> <66061bf2-9092-42a5-918e-5a039a53db20@googlegroups.com> <6ca07e69-1694-49c1-93eb-748c44d8ab68@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="8785"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bWkuYrPJ/gG1FyOU1bz59BGHAmO5PcJ8=" Cancel-Lock: sha1:ofUZ8wtt8PFMjNhmODxFEZFcd6U= sha1:IWGVpDvBrmnDoQgEipIqjb0mEO0= X-BSB-Auth: 1.d89b67ff4b3cd6d00873.20150501105816BST.871tj08vrb.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27448 "Evertjan." writes: > Build and think modular: > > function arraySwap(a, b) { // 2 different arrays expected > var tempArrName = b; > b = a; > a = tempArrName; > // the name tempArrName will be garbagecollected automagically > }; > > function arraySwapIfSmaller(a, b) { // arrays by reference > if (arrCompareSmaller(a, b)) > arraySwap(a, b); > }; I don't think this does what you think it does. arraySwap has no effect on the arrays that are passed as parameters. -- Ben.