Merhaba,
bunun için bir fonsksiyon kullanacağız.
Kullanacağımız fonksiyon:
Kullanımı :
bunun için bir fonsksiyon kullanacağız.
Kullanacağımız fonksiyon:
Kod:
function calculateAge(birthMonth, birthDay, birthYear)
{
todayDate = new Date();
todayYear = todayDate.getFullYear();
todayMonth = todayDate.getMonth();
todayDay = todayDate.getDate();
age = todayYear - birthYear;
if (todayMonth < birthMonth - 1)
{
age--;
}
if (birthMonth - 1 == todayMonth && todayDay < birthDay)
{
age--;
}
return age;
}Kod:
document.write("Taha bugün itibarıyla " + calculateAge(11,2,1999) + " yaşında." );Son Düzenleme: 17-04-2020, 01:10, Düzenleyen: T1xLnN

