Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29269
| X-Received | by 10.182.120.106 with SMTP id lb10mr16187358obb.24.1452986662773; Sat, 16 Jan 2016 15:24:22 -0800 (PST) |
|---|---|
| X-Received | by 10.50.108.20 with SMTP id hg20mr101961igb.5.1452986662746; Sat, 16 Jan 2016 15:24:22 -0800 (PST) |
| Path | csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!o2no3804029iga.0!news-out.google.com!kr2ni565igb.0!nntp.google.com!h5no5663381igh.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.javascript |
| Date | Sat, 16 Jan 2016 15:24:21 -0800 (PST) |
| In-Reply-To | <4ab38ff8-e97b-43cb-9077-b5ca6ee23ea1@googlegroups.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=85.229.217.28; posting-account=kxPkPAoAAACjJi8w0gL9bnyznPzdw9HW |
| NNTP-Posting-Host | 85.229.217.28 |
| References | <4ab38ff8-e97b-43cb-9077-b5ca6ee23ea1@googlegroups.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <ab9028a9-0ee4-41ca-aefc-d01e0fb008fa@googlegroups.com> (permalink) |
| Subject | Re: Found a bug in javascript see what it printout |
| From | jonas.thornvall@gmail.com |
| Injection-Date | Sat, 16 Jan 2016 23:24:22 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Xref | csiph.com comp.lang.javascript:29269 |
Show key headers only | View raw
Den söndag 17 januari 2016 kl. 00:15:02 UTC+1 skrev jonas.t...@gmail.com:
> <script language="Javascript">
>
> function factor_it(i){
> prime=true;
> sqroot=Math.floor(Math.sqrt(i));
> for (j=2;j<sqroot;j++){ k=i/j; prime=!Number.isInteger(k); if (prime) {return prime}}
> return prime;
> }
>
> function main(){
> base=10;
> outStr="";
>
> //while (base==10) {
> prime=false;
> primeleg=false;
> j=1;
>
> while(j<base){
>
> i=j;
> i=i+base;
> while (i<100){
>
> // primeleg=factor_it(i);
> if(primeleg==true){break;}
> i=i+base;
> }
> j++;
> outStr+="Base="+base+" counterval i = "+ i +" P primeleg ="+primeleg+"\n";
> }
>
> //base++;
> //}
> document.prima.out.value =outStr;
> }
> </script>
> <!DOCTYPE html>
> <head>
> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
> </head>
>
> <body onload="main()" bgcolor="gold">
> <form name="prima" action="" onsubmit="MAIN(); return false;">
> <textarea name="out" cols=80 rows=80></textarea>
> <textarea name="trash" cols=80 rows=80></textarea>
> </form>
> </body>
> </html>
Bug resolved it was in brain double use of j in two loops.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Found a bug in javascript see what it printout jonas.thornvall@gmail.com - 2016-01-16 15:14 -0800
Re: Found a bug in javascript see what it printout jonas.thornvall@gmail.com - 2016-01-16 15:24 -0800
Re: Found a bug in javascript see what it printout "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-16 16:05 -0800
Re: Found a bug in javascript see what it printout "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-01-17 11:42 -0800
Re: Found a bug in javascript see what it printout Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-18 19:59 +0100
Re: Found a bug in javascript see what it printout "Chris M. Thomasson" <nospam@nospam.nospam> - 2016-01-18 11:19 -0800
csiph-web