Advertisement
ShadowEmbrace

Untitled

Jan 23rd, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function () {
  2.     let checkButton = document.querySelector('button');
  3.  
  4.     checkButton.addEventListener('click', () => {
  5.         let year = Number(document.querySelector('input').value);
  6.         let isLeap = 'Not Leap Year';
  7.  
  8.         if (year !== 0 && (((year % 4 === 0) && (year % 100 !== 0)) || year % 400 === 0)) {
  9.             isLeap = 'Leap Year';
  10.         }
  11.  
  12.         document.querySelector('#year h2').textContent = isLeap;
  13.         document.querySelector('#year div').textContent = year;
  14.  
  15.         document.querySelector('input').value = '';
  16.     });
  17. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement