Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: How to manipulate integer that sometimes Nan and sometimes have a value? Date: Sat, 26 Sep 2015 10:59:06 +0100 Organization: A noiseless patient Spider Lines: 21 Message-ID: <87wpvdec2d.fsf@bsb.me.uk> References: <9060ce04-2f9e-4554-be83-2f69c213424f@googlegroups.com> <4f31ec16-109f-43b2-9d50-b39d4fb47f84@googlegroups.com> <3cf46737-de54-489e-9d9d-89413b18c099@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="23485"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KWHSBb8ltVdPXEE4tszTPz/KjYFaV9Ws=" Cancel-Lock: sha1:eg0P/1qdQADOMWksf1LPortNpVw= sha1:kkO5Fw4ZSGBBhU42lRtLPNAB+L4= X-BSB-Auth: 1.8bb5d91d5d047ce0e767.20150926105906BST.87wpvdec2d.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:28721 jonas.thornvall@gmail.com writes: > Den lördag 26 september 2015 kl. 00:11:31 UTC+2 skrev Danny: >> to jonas.t >> >> in short, if the value is an integer, it will never return NaN. >> What if may be happening in your case, is that the object gets >> something else other than a numeric value. >> >> but a solution depends on what the context for all that is >> and you haven't given us context or relevant code of the matter > > Well sometimes the index of the array is empty for the leading > position, it is an carry operation. As yet unassigned positions in an array are undefined but the isNaN function returned true for undefined values. It's likely that you don't have a numeric NaN in addOne[i], but undefined instead. -- Ben.