Why does console show computerChoice twice when only called once?


4. Computer Choice: Part 2

I'm just trying to figure out why the console shows the value of computerChoice twice? Since we have only passed the variable to the console.log function after it has evaluated to a random number, why does it then also show rock, paper, or scissors? Does scope come into play? If we are merely redefining the value of the variable, what causes it to print the new value

var userChoice = prompt("Do you choose rock, paper or scissors?");

var computerChoice = Math.random();


if (computerChoice > 0 && computerChoice <0.33) {
else if

    (computerChoice >0.34 && computerChoice <0.66){
    computerChoice ="paper";



The codecademy console is just echoing the last value, which can be confusing or useful (once you know this, it can be pretty useful, but confusing if you don't)


so is this unique to the code academy console or is this how other consoles work (browser, ide, etc..)?

Also, if this was run outside of code academy, are you saying that it wouldn't print rock, paper, or scissors, until the variable was passed to console.log again?


the chrome console also seem to have this behavior (at least, someone had this issue couple days ago), if you for example use jsbin (make sure to use console + js) the variable would only be printed if passed in to console.log again