Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #25443
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2014-07-18 10:28 -0700 |
| References | <cb3a7a8c-b4b5-4cce-8184-ebfdaf9a9d8b@googlegroups.com> <XnsA36EC3A863756eejj99@194.109.133.133> |
| Message-ID | <4fcfff57-3b7e-47fe-bc56-f006d847d652@googlegroups.com> (permalink) |
| Subject | Re: I need help with the following code. |
| From | Iria Vasquez-Paez <iriavp@gmail.com> |
On Friday, July 18, 2014 10:14:02 AM UTC-7, Evertjan. wrote:
> Iria Vasquez-Paez <iriavp@gmail.com> wrote on 18 jul 2014 in
>
> comp.lang.javascript:
>
>
>
> > This is the code as it starts on Code Academy.com. I'd greatly
>
> > appreciate help on this.
>
> >
>
> > var bool = true;
>
> >
>
> > while(bool === true){
>
> > console.log("Less is more!");
>
> > bool = false;
>
> >}
>
>
>
> This is nonsense code as it can be reduced to
>
>
>
> var bool = true;
>
> console.log("Less is more!");
>
> bool = false;
>
>
>
> which can be reduced to:
>
>
>
> var bool = false;
>
> console.log("Less is more!");
>
>
>
> > You have to remove the equals signs.
>
>
>
> Why? [I don't take commands from strangers.]
>
>
>
> > var bool = true;
>
> >
>
> > while(bool = true){
>
> > console.log("Less is more!");
>
> > bool = false;
>
> >}
>
>
>
> same result, can be reduced to:
>
>
>
> var bool = false;
>
> console.log("Less is more!");
>
>
>
> > This is my solution that does't pass the editor.
>
>
>
> You probably mean something else than an editor,
>
> as an editor just edits a textfile and passes all texts.
>
>
>
> > var bool = true;
>
> > while(bool) {
>
> > console.log ("Less is more!";
>
> > bool = false;
>
> >}
>
>
>
> missing closing ")" in line 3, should be:
>
>
>
> console.log ("Less is more!");
>
>
>
> > This solution is a problem with syntax.
>
>
>
> It is not a solution,
>
> as solution means your problem is gone.
>
>
>
> > Other solutions cause my browser to crash.
>
>
>
> Undoubtedly you can make other syntax mistakes,
>
> and mistakenly call tham a solution.
>
>
>
> But I doubt syntax errors in JS crash a modern browser,
>
> probably it just freezes them when you make a endless loop,
>
> and should warn you after a timeout.
>
>
>
> But there always are countless "other solutions" that are not syntax errors.
>
>
>
> > I need to solve this headache in order to move on.
>
>
>
> Paracetamol?
>
>
>
> > I have gone ahead but I am not progressing with this problem.
>
>
>
> Impossible as "progressing" and "going ahead" just mean the same.
>
>
>
> > I really need a
>
> > solution. The above solution is a syntax problem. Thanks
>
>
>
> You don't ask for anything here, so why the "thanks"?
>
>
>
> A syntax error is not a solution.
>
>
>
> You don't even tell what you want your code to do,
>
> and your examples do nothing.
>
>
>
> Perhaps, dear Iria, you could restart and tell us
>
> what you want your code to do.
>
>
>
> Or is it your teacher giving you homework?
>
>
>
> --
>
> Evertjan.
>
> The Netherlands.
>
> (Please change the x'es to dots in my emailaddress)
Evertjan, I need a solution.
Here is the question from Code Academy.com. I really should have posted it earlier.
Brevity is the soul of programming
You may have noticed that when we give a variable the boolean value true, we check that variable directly--we don't bother with ===. For instance,
var bool = true;
while(bool){
//Do something
}
is the same thing as
var bool = true;
while(bool === true){
//Do something
}
but the first one is faster to type. Get in the habit of typing exactly as much as you need to, and no more!
If you happen to be using numbers, as we did earlier, you could even do:
var myNumber = 1;
while(myNumber) {
// Do something!
}
Instructions
We've written the less succinct version in the editor. Correct it to the more elegant version!
?
Stuck? Get a hint!
Your condition Your condition should only be:
while(bool)
Do the instructions make more sense to everybody now that I've posted it? Thanks for the responses so far. I am asking for a full-blown solution. Yes I know I have an infinite loop. The question is how to resolve the infinite loop. Thanks,
Iria
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I need help with the following code. Iria Vasquez-Paez <iriavp@gmail.com> - 2014-07-18 09:39 -0700
Re: I need help with the following code. Tim Streater <timstreater@greenbee.net> - 2014-07-18 18:07 +0100
Re: I need help with the following code. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-07-18 19:14 +0200
Re: I need help with the following code. Iria Vasquez-Paez <iriavp@gmail.com> - 2014-07-18 10:28 -0700
Re: I need help with the following code. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-07-18 19:51 +0200
Re: I need help with the following code. Iria Vasquez-Paez <iriavp@gmail.com> - 2014-07-18 11:24 -0700
Re: I need help with the following code. Tim Streater <timstreater@greenbee.net> - 2014-07-18 20:06 +0100
Re: I need help with the following code. Iria Vasquez-Paez <iriavp@gmail.com> - 2014-07-18 12:27 -0700
Re: I need help with the following code. Iria Vasquez-Paez <iriavp@gmail.com> - 2014-07-18 12:47 -0700
Re: I need help with the following code. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-07-18 21:30 +0100
Re: I need help with the following code. Iria Vasquez-Paez <iriavp@gmail.com> - 2014-07-18 14:41 -0700
Re: I need help with the following code. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-07-18 23:28 +0100
Re: I need help with the following code. Iria Vasquez-Paez <iriavp@gmail.com> - 2014-07-18 16:54 -0700
Re: I need help with the following code. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-07-19 01:57 +0100
Re: I need help with the following code. Mike Duffy <md_002@videotron.ca> - 2014-07-18 21:29 -0400
Re: I need help with the following code. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-07-19 03:00 +0100
Re: I need help with the following code. Gene Wirchenko <genew@telus.net> - 2014-07-21 10:23 -0700
Re: I need help with the following code. Tim Streater <timstreater@greenbee.net> - 2014-07-19 09:11 +0100
Re: I need help with the following code. Tim Streater <timstreater@greenbee.net> - 2014-07-18 21:33 +0100
Re: I need help with the following code. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-07-18 22:06 +0200
Re: I need help with the following code. Iria Vasquez-Paez <iriavp@gmail.com> - 2014-07-18 10:23 -0700
Re: I need help with the following code. Tim Streater <timstreater@greenbee.net> - 2014-07-18 18:27 +0100
Re: I need help with the following code. danca <cyberdanny@tiscalinet.it> - 2014-07-18 22:04 +0200
Re: I need help with the following code. danca <cyberdanny@tiscalinet.it> - 2014-07-18 22:53 +0200
Re: I need help with the following code. danca <cyberdanny@tiscalinet.it> - 2014-07-18 22:56 +0200
Re: I need help with the following code. Tim Streater <timstreater@greenbee.net> - 2014-07-18 22:08 +0100
Re: I need help with the following code. danca <cyberdanny@tiscalinet.it> - 2014-07-18 23:37 +0200
Re: I need help with the following code. John Harris <niam@jghnorth.org.uk.invalid> - 2014-07-20 10:50 +0100
Re: I need help with the following code. danca <cyberdanny@tiscalinet.it> - 2014-07-20 20:56 +0200
Re: I need help with the following code. Tim Streater <timstreater@greenbee.net> - 2014-07-20 22:40 +0100
Re: I need help with the following code. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-07-21 07:41 +0200
Re: I need help with the following code. Scott Sauyet <scott.sauyet@gmail.com> - 2014-07-21 11:49 -0700
Re: I need help with the following code. danca <cyberdanny@tiscalinet.it> - 2014-07-22 13:58 +0200
Re: I need help with the following code. Scott Sauyet <scott.sauyet@gmail.com> - 2014-07-22 07:45 -0700
Re: I need help with the following code. danca <cyberdanny@tiscalinet.it> - 2014-07-22 21:54 +0200
Re: I need help with the following code. Iria Vasquez-Paez <iriavp@gmail.com> - 2014-07-18 14:42 -0700
Re: I need help with the following code. danca <cyberdanny@tiscalinet.it> - 2014-07-19 00:00 +0200
Re: I need help with the following code. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-07-18 23:42 +0100
Re: I need help with the following code. Denis McMahon <denismfmcmahon@gmail.com> - 2014-07-18 21:12 +0000
csiph-web