SHARE
TWEET

Untitled

a guest May 24th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function growingWord() {
  2.  
  3.   let clicks = 0,
  4.   button  = document.querySelector('button'),
  5.   paragraph = document.querySelector('#exercise p');
  6.   color = '';
  7.  
  8.   button.onclick = function() {
  9.     clicks += 1;
  10.  
  11.     if(clicks % 3 === 0){
  12.       color = 'red';
  13.     }
  14.     else if(clicks % 3 === 1){
  15.       color = 'blue';
  16.     }
  17.     else if(clicks % 3 === 2){
  18.       color = 'green';
  19.     }
  20.  
  21.     paragraph.style.color = color;
  22.     paragraph.style.fontSize = `${clicks * 2}px`;
  23.   };
  24.  
  25.   console.log(clicks);
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top