I enter the following code in FireBug’s console on Win 7 latest, Firefox 11:
var age = 26;
while ( age < 37 ) {
console.log("You can join!");
console.log(age);
age++;
}
It spits out what I’m looking for but prints an additional ’36’ at the very end. I don’t understand why.
Here’s what I’m looking to do:
1. Check if the person is younger than 37 years old (they can’t be 37 or older).
2. If they meet the requirement it should print “You can join!”
That’s it. Why is it spitting out an extra 36 at the end?
I just started studying JavaScript and this snippet is not being used for anything, I’m just plugging code into FireBug for fun.
I’m new to stackoverflow, too. Thanks for the support.
That is how it behaves normally. By default Firebug shows the value of the last statement.
You can see
falsein console. I guess it is because firebug useseval. The following statement also returns the same.