Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Bug in javascript found Date: Tue, 09 Feb 2021 21:01:09 +0000 Organization: A noiseless patient Spider Lines: 32 Message-ID: <87pn19hs6i.fsf@bsb.me.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="f279be6a11f76286a3ed66bf08db9fe3"; logging-data="29463"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zo4VB5wqZJsLUNR6vpJCeImKmb7xFHhw=" Cancel-Lock: sha1:CygoM4SDLXJDsFRinLOfK793EVA= sha1:edsBUjAPRkj49ORhFMV+fAjAdMg= X-BSB-Auth: 1.b6e53d14431160b681c4.20210209210109GMT.87pn19hs6i.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:39443 Jonas Thörnvall writes: > The input alert have not same value as the calcSTR alert. > And that is also why it not goes into the if clause. > > The "Input"+calcSTR is +7 > but the "calcSTR"+calcSTR is +14-7 > > A string can't just change value so there must be a bug in at least > Chrome implementation of javascript. > > function evalSecondary(calcSTR){ > alert("Input"+calcSTR); > for(m=0;m tempChar=calcSTR.charCodeAt(m); > //Plus or Minus > if((tempChar==43|| tempChar==45) && m!=0){ > alert("tempChar "+tempChar+ " M="+m+" calcSTR"+calcSTR); > operand=calcSTR.charAt(m); > getSecondaryOps(calcSTR); > calcSubSecondary(calcSTR); > } > } > } You need to post a small, complete example that demonstrates the problem. You are still using what I'd loosely describe as global variables and that makes you code one giant interconnected web of potential side-effects. -- Ben.