“Sprungjahrsfunktion JavaScript” Code-Antworten

JavaScript -Schaltjahr

function isLeapYear(year){
	if(year % 400 === 0 && year % 4 === 0){
      return true
    } else {
      return false
    }
}
Glamorous Goose

So überprüfen Sie das Schaltjahr in JavaScript

function isLeapYear(year) {
  if (year % 400 === 0) return true;
  if (year % 100 === 0) return false;
  return year % 4 === 0;
}
Asif Hasan Irfan

Sprungjahrsfunktion JavaScript

function isLeapYear(year) {
    if (year % 4 == 0) {
        console.log("leap year")
    } else {
        console.log("Not a leap year")
    }
}
var myYear = 2020;
isLeapYear(myYear)
// Output:leap year
Ariful Islam Adil(Code Lover)

Ähnliche Antworten wie “Sprungjahrsfunktion JavaScript”

Fragen ähnlich wie “Sprungjahrsfunktion JavaScript”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen