Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function growingWord() {
- let clicks = 0,
- button = document.querySelector('button'),
- paragraph = document.querySelector('#exercise p');
- color = '';
- button.onclick = function() {
- clicks += 1;
- if(clicks % 3 === 0){
- color = 'red';
- }
- else if(clicks % 3 === 1){
- color = 'blue';
- }
- else if(clicks % 3 === 2){
- color = 'green';
- }
- paragraph.style.color = color;
- paragraph.style.fontSize = `${clicks * 2}px`;
- };
- console.log(clicks);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement