dayOfProgrammer.js

    0

    1

    returns "3.0.0". dayOfProgrammer(2000) returns "2.0.0". dayOfProgrammer(1900) returns "1.0.0".

    function dayOfProgrammer(year) {
      let is29 = year % 4 === 0;
      let maxDate = 256;
      let endDay = 0;
      let ninethDay = 0;
      let month = 9;
      let currentYear = 2016;
      let copyYear = year;
    
      if (year >= 2016) {
        debugger;
        for (let i = 0; i < 2016; i++) {
          debugger;
          if (year === 2016) {
            debugger;
            endDay = 244;
            ninethDay = maxDate - endDay;
            return `${ninethDay}.0${month}.${copyYear}`;
          } else if (year < 2016) {
            endDay = 243;
            ninethDay = maxDate - endDay;
            return `${ninethDay}.0${month}.${copyYear}`;
          }
          year -= 4;
        }
      } else {
        debugger;
        for (let i = 0; i < 2016; i++) {
          debugger;
          if (year === 2016) {
            debugger;
            endDay = 244;
            ninethDay = maxDate - endDay;
            return `${ninethDay}.0${month}.${copyYear}`;
          } else if (year > 2016) {
            endDay = 243;
            ninethDay = maxDate - endDay;
            return `${ninethDay}.0${month}.${copyYear}`;
          }
          year += 4;
        }
      }
    }
    
    dayOfProgrammer(2100)
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.