Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #39446

Re: Bug in javascript found

Path csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Bug in javascript found
Date Wed, 10 Feb 2021 02:16:02 +0000
Organization A noiseless patient Spider
Lines 39
Message-ID <878s7wis65.fsf@bsb.me.uk> (permalink)
References <ad443096-b466-4cdc-a0f8-edc0d815fa5en@googlegroups.com> <7ad3dfb3-90b3-4fce-b537-55511a64cea8n@googlegroups.com> <6c7176b7-13fe-4381-8083-ccc58fc4fcb6n@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding 8bit
Injection-Info reader02.eternal-september.org; posting-host="1cf95790cca243eb5e1e6b17078f9ce0"; logging-data="28973"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lyZlRK86SQiWKt7htbzReo1LPyG8Hsvw="
Cancel-Lock sha1:mZNnmtf9tNDud/i2YBCFs3Z1zDI= sha1:yb7Xjwif0eepdgOYY1mIbYiax4w=
X-BSB-Auth 1.96ce2303ae9cbe19a1f0.20210210021602GMT.878s7wis65.fsf@bsb.me.uk
Xref csiph.com comp.lang.javascript:39446

Show key headers only | View raw


Jonas Thörnvall <jonas.thornvall@gmail.com> writes:

> tisdag 9 februari 2021 kl. 22:03:22 UTC+1 skrev Jonas Thörnvall:
>> tisdag 9 februari 2021 kl. 21:42:46 UTC+1 skrev Jonas Thörnvall:
>> > 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<calcSTR.length;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);
>> > } 
>> > } 
>> > }
>> Well you see the code creating the alerts. 
>> https://jonasth.github.io/Mathparse/INDEX.HTML 
>> It is an impossibility frankly.
> I simply could not understand why the recursion never ended, but then
> again if a variable can change value "within same function" while not
> assigned between two alerts then something definitely broken.

It is not going to turn out to be Chrome that's broken.  Your code is a
mess, but the biggest problem is that you are still using global
variables.  These are always a bad idea, but they are particularly bad
in recursive code.

-- 
Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Bug in javascript found Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-02-09 12:42 -0800
  Re: Bug in javascript found Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-02-09 12:43 -0800
  Re: Bug in javascript found Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-02-09 21:01 +0000
  Re: Bug in javascript found Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-02-09 13:03 -0800
    Re: Bug in javascript found Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-02-09 13:14 -0800
      Re: Bug in javascript found Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-02-10 02:16 +0000
        Re: Bug in javascript found Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-02-10 01:11 -0800
          Re: Bug in javascript found Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-02-10 11:20 +0000
  Re: Bug in javascript found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-02-14 00:52 +0100
    Re: Bug in javascript found Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-02-13 16:32 -0800
    Re: Bug in javascript found John G Harris <niam@jghnorth.org.uk.invalid> - 2021-02-14 10:22 +0000
  Re: Bug in javascript found Silvio <silvio@internet.com> - 2021-02-14 10:38 +0100

csiph-web