The Command Editor evaluates the code entered and outputs its result. So 
the last number listed in the output (1346269) is the value returned by 
your code.
So if you execute 1+1 into the Command Editor or Command Line, you'll get 2 
as result.
You can verify that by logging your numbers using some styling:

var x1=0;
var x2=1;
var x3;

console.log(x1);
while(x2<1000000){
  console.log('%c' + x2, 'color: green;');
  x3=x1;
  x1=x2;
  x2=x3+x2;
}

By that the output of your code will be listed in green while the return 
value of the evaluation will still be shown in dark blue.

To avoid getting the last number simply put your calculation code into a 
function and call that function:

function fibonacci(x1, x2) {
  var x3;

  console.log(x1);
  while(x2<1000000){
    console.log(x2);
    x3=x1;
    x1=x2;
    x2=x3+x2;
  }
}

fibonacci(0, 1);

Then the last logged line will be undefined indicating that the evaluated 
code didn't return anything.

Sebastian

On Saturday, December 6, 2014 5:32:40 AM UTC+1, David Costa wrote:
>
> hello, i was playing a bit with firebug and i was trying to do a quick 
> thing in it and i have created the following code to find fibonacci numbers 
> until 1million.
>
> var x1=0;
> var x2=1;
> var x3;
>
> console.log(x1);
> while(x2<1000000){
>   console.log(x2);
>   x3=x1;
>   x1=x2;
>   x2=x3+x2;
>   //console.log("--"+x2);
> }
>
> i created this code in command editor and what happened after running it 
> and reviewing the code is that the last number is wrong, it stays outside 
> of the inequality, it is greater.
>
> And i have checked that using the same code in an html5 file with the 
> markups it works fine.
>
> I think it is some kind of parse or reassembly of the code, like the way 
> there can be code put in a tree of symbols.
> It means that code from inside the command editor box is work differently 
> than from the current webpage...
>
> I know dealing with an entire programming language with javascript is 
> kinda buggy. and the web browser has to work flawlessly...
>
> Hope i helped ;)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/firebug.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/firebug/70bf4469-f2f9-4189-b4fa-4c44239aad91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to