Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.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: permuting a JS vector Date: Sun, 31 May 2015 22:42:40 +0100 Organization: A noiseless patient Spider Lines: 17 Message-ID: <87twusfmpb.fsf@bsb.me.uk> References: <47b347a2-ab29-4722-963c-2c616ca7095c@googlegroups.com> <87a8wkh7jq.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="20883"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pj68sDJwbAo/JCE9mNVJ5yci9ebjFixY=" Cancel-Lock: sha1:GeONkAnZf1CMje2s7fXNZabxZYU= sha1:FsRdiR62a+XsUGEVOIy6EdgeNkg= X-BSB-Auth: 1.04a57f8490ffd79a9b44.20150531224240BST.87twusfmpb.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27951 dr.mtarver@gmail.com writes: > On Sunday, May 31, 2015 at 8:27:22 PM UTC+1, Ben Bacarisse wrote: >>[...] The push function returns the new array length, >> not an array. This last one is why you get the error. >> > ah - a side-effect function then - that mutates an array but returns > number? Yes. You'll need a reference if you are learning JavaScript as you can't really guess. For example: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push -- Ben.