Question: What am I doing wrong? If the button is clicked, variable s will have a value of 10, if not, it's 0. It's not working though. 

```
$('button').observe('click', function () {
  var clicked = true;
  window.clicked = clicked;
});

if (clicked)
{
    var s = 10;
}
else 
{
    var s = 0; 
}

```

Answer: 
This might help you-

```
    <button>
    click
    </button>

<script>
       var clickCounter=0;
        var s=0;
        alert(s);
        $('button').on('click',function(){
          var s=10;
            alert(s);
            });
</script>

```

Initially the variable will store value of 0, after the vutton is clicked the variable is assigned with value of 10.
You are creating a variable S inside the if and else scope.
Create a var s outside of the if and else and assign afterwards

Or you can do it like this:

```
   var s = 0;    
   $('button').observe('click', function () {
      s = 10;
   });

```

This way you assign 10 to s only after click. The code you had before would never set anything to 10