forked from maztarigan/matdisk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20190801354_Tugas_Usia.js
32 lines (25 loc) · 1.22 KB
/
20190801354_Tugas_Usia.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
console.log("HELLO WORLD :)");
console.log("Tugas Menghitung Usia");
console.log(" Nama : Androw Ragilson ");
var NOW = new Date();
var SISWA =[
{"Nama":"AL ", "ULTAH":new Date('1997-02-19')},
{"Nama":"AR ", "ULTAH":new Date('1997-10-28')},
{"Nama":"ANDRI ", "ULTAH":new Date('2000-02-29')},
{"Nama":"ANRIAN ", "ULTAH":new Date('1999-10-29')},
{"Nama":"DIMS ", "ULTAH":new Date('2000-06-21')},
{"Nama":"TIARA ", "ULTAH":new Date('2001-03-06')},
{"Nama":"NIA ", "ULTAH":new Date('2001-12-14')},
{"Nama":"KRESNA ", "ULTAH":new Date('2000-11-29')},
{"Nama":"LZ ", "ULTAH":new Date('1996-06-26')},
{"Nama":"SUTNA ", "ULTAH":new Date('1998-12-24')},
{"Nama":"FIKRY ", "ULTAH":new Date('1997-05-17')},
{"Nama":"JHORDY ", "ULTAH":new Date('2001-11-15')},
{"Nama":"RAIHAN ", "ULTAH":new Date('2000-05-01')},
{"Nama":"JAWIR ", "ULTAH":new Date('2001-03-01')},
{"Nama":"SINDY ", "ULTAH":new Date('2001-06-30')}];
for(i=0; i<SISWA.length; i++) {
BIRTHDAY = SISWA[i].ULTAH;
var diffDays = parseInt((NOW.getYear() - BIRTHDAY.getYear()));
console.log(SISWA[i].Nama + " Saat ini berusia " + diffDays + " Tahun");
}