Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

leap year list

function leap_year_range(st_year, end_year) {
        var year_range = [];
        for (var i = st_year; i <= end_year; i++)
        {
             year_range.push(i);
        }
        var new_array = [];

  year_range.forEach(
   function(year)
    { 
       if (test_LeapYear(year)) 
       new_array.push(year);
    });

  return new_array;
     }

function test_LeapYear(year) {
   if ((year % 4 === 0 && year % 100 !== 0) || (year % 100 === 0 && year % 400 === 0)) {
                return year;
        } else {
                return false;
        }
}

console.log(leap_year_range(2000,2012))
Comment

Leap year list

function leap_year_range(st_year, end_year) {
        var year_range = [];
        for (var i = st_year; i <= end_year; i++)
        {
             year_range.push(i);
        }
        var new_array = [];

  year_range.forEach(
   function(year)
    { 
       if (test_LeapYear(year)) 
       new_array.push(year);
    });

  return new_array;
     }

function test_LeapYear(year) {
   if ((year % 4 === 0 && year % 100 !== 0) || (year % 100 === 0 && year % 400 === 0)) {
                return year;
        } else {
                return false;
        }
}

console.log(leap_year_range(2000,2012));
Comment

PREVIOUS NEXT
Code Example
Javascript :: Turn Module Into Non Module 
Javascript :: javascript assignment by reference or value 
Javascript :: function x(a) vs function x(...a) the difference 
Javascript :: Creating Multiple Methods From A List Of Words 
Javascript :: phaser reverse matrix columns 
Javascript :: phaser change scene 
Javascript :: inspect vuex store 
Javascript :: creating hashblock method using sha256 hashing algorithm 
Javascript :: Create Nodejs logger that does not replace file when app/server restarts 
Javascript :: ms dyn crm associate n:m record js 
Javascript :: javascript quotes 
Javascript :: javascript reverse string short hand 
Javascript :: javascript for website design center text 
Javascript :: Get First Second Third Term In Array 
Javascript :: JavaScript Using es6(ES2015) Destructuring assignment 
Javascript :: nested object data 
Javascript :: on submit success jquery 
Javascript :: animation in react stack overflow 
Javascript :: wp include js 
Javascript :: geteliment by id in javascript 
Javascript :: using nodeenv 
Javascript :: React Futures - Server Components 
Javascript :: unknown set of argument 
Javascript :: javascript number reverse 
Javascript :: popper js 
Javascript :: && condition in javascript 
Javascript :: Access to localhost from other machine - Angular 
Javascript :: getmonth javascript 
Javascript :: how to reverse sort lines in javascript 
Javascript :: The DOM Parent-Child Relationship 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =