Advertisement
Guest User

Kod

a guest
Feb 28th, 2020
1,909
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.65 KB | None | 0 0
  1. var year = 0
  2. var month = 0
  3. var day = 0
  4. var divisibility = function(number){
  5.     if (number%4 == 0) {
  6.         return  true
  7.     } else {
  8.         return false
  9.     }
  10. }
  11.  
  12.  
  13. for (i=0; i<10; i++) {
  14.  
  15.     month = Math.floor(Math.random() * 12); //losowanie miesiąca
  16.     year = Math.floor(Math.random() * 3000); //losowanie roku
  17.  
  18.  
  19.     if (month = 1 || 3 || 5 || 7 || 8 || 10 || 12) {
  20.         day = Math.floor(Math.random() * 31)
  21.     } else if (month = 2 && divisibility(year)) {
  22.         Math.floor(Math.random() * 28);
  23.     } else if (month = 2) {
  24.         Math.floor(Math.random() * 29);
  25.     } else {
  26.         Math.floor(Math.random() * 30);
  27.     }
  28.  
  29.     $("body").append("<h2>" + day + "." + month + "." + year + "</h2>");
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement