I am new to Javascript and HTML. I tried creating a button that turns white when clicked, although every time i run this code it get the error of `TypeError: Cannot read prperty 'value' of null`, telling me I am not calling the button properly. When searching around online, I found that I should be able to use this.id, but that also has not worked

```
function newBtn(num){
 var n = 0;
 while(n<num){
  n++;
  var btn = document.createElement('button');
  btn.className = 'dots';
  btn.setAttribute('value', 1);
  btn.setAttribute('id', 'dot'+n);
  btn.onclick = light(this.id);
  btn.style.left = '200';
  document.body.appendChild(btn);
 }
}

function light(id){
 var dot=document.getElementById(id);
 var value = dot.value;
 if (value<4){
    dot.style.background="white";
 }
}

```