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: Merge indexes.. Date: Wed, 20 May 2015 11:42:55 +0100 Organization: A noiseless patient Spider Lines: 39 Message-ID: <87h9r7o7gw.fsf@bsb.me.uk> References: <143762f6-417f-4f3f-82d5-272939e581d9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="20886"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19p+Vuc8O+FYbv2+QyfverTN5XYjI/UuKI=" Cancel-Lock: sha1:57O+dcgmWRJFWiTaXsI/A4Iv03s= sha1:+AKz3cwHfMpvfKV7D1QdGbn+Z1M= X-BSB-Auth: 1.1502e97036d4923dfc5e.20150520114255BST.87h9r7o7gw.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:27767 jonas.thornvall@gmail.com writes: > Den onsdag 20 maj 2015 kl. 08:59:15 UTC+2 skrev jonas.t...@gmail.com: >> I need to merge integers at indexes within an array into an integer? >> [7,9,8] = 798 >> >> No join i need an integer value. >> >> How? > > Sorry i was thinking wrong should be 897, i have one way todo it. But > i was thinking it should be possible to do with just concatenations > rather than arithmetic? That's because you are still not clear about the distinction between a number and its representation. If you have Number values (that's an ECMAScrip type) then arithmetic is the correct way to produce new numbers like this. > Don't make you code worse by adding yet more function that communicate via globals. This operation is a self-contained function of the array. Pass the array as a parameter and return the result from the function. -- Ben.