A Pen by Sierra Gregg

Thumbnail
This awesome code was written by 13thDayCoder, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 13thDayCoder ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Sierra Gregg</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <table id="table">

</table>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/13thDayCoder/a-pen-by-sierra-gregg-RZywmW */
var table = document.selectElementById('table');

function daysInMonth(month, year) {
  return new Date(year, month + 1, 0).getDate();
}

var days = daysInMonth(7, 2017);
var row = null;
var cell = null;
console.log(days);
for(var i = 0; i < 5; i++) {
  // row = table.insertRow(i);
  for(var j = 0; j <= 7 && days > 0; j++) {
    // cell = row.insertCell(j);
    console.log(days);
    // cell.innerHTML = days;
    days--;
  }
}

Comments