// your "ECMAscript" does not belong here... var btn = document.querySelector('button'); var canvas = document.querySelector('canvas'); // var ctx = canvas.getContext('2d'); //NO var WIDTH = document.documentElement.clientWidth; var HEIGHT = document.documentElement.clientHeight; // // your "ECMAscript" does not belong here... //+++++ endVAR canvas.width = WIDTH; canvas.height = HEIGHT; //++ beginFUNC S function random(number) { return Math.floor(Math.random()*number);} // function draw() { ctx.clearRect(0,0,WIDTH,HEIGHT); for (let i = 0; i < 100; i++) { ctx.beginPath(); ctx.fillStyle = 'rgba(255,0,0,0.5)'; // ctx.arc(random(WIDTH), random(HEIGHT), random(50), 0, 2 * Math.PI); ctx.fill(); } } //+DO or%20DON'T btn.addEventListener('click',draw); //