Skip to content

Commit 358e3dc

Browse files
committed
test
1 parent c889e00 commit 358e3dc

64 files changed

Lines changed: 1202 additions & 30 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62. SetInterval/main.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11

22
let count = 0
3-
let max = prompt(`set a number`)
4-
max = Number(max)
3+
let hasil = prompt("Seberapa Besar Cinta ku padamu")
4+
hasil = Number(hasil)
5+
let interval = setInterval(Test, 1)
56

6-
const mytimer = setInterval(countup,1)
7-
8-
function countup(){
9-
count += 1
10-
11-
if (count <= max){
12-
document.getElementById("count").innerHTML = count
13-
}else if(count >= max){
14-
clearInterval(mytimer)
7+
function Test(){
8+
9+
if(count < hasil){
10+
count +=1
11+
document.getElementById("count").innerHTML = `${count}%`
12+
}else{
13+
clearInterval("interval")
1514
}
1615

17-
1816
}
1917

20-

62. SetInterval/style.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.parg{
2-
font-size: 2em;
3-
font-family: 'Times New Roman', Times, serif;
2+
font-size: 3em;
3+
color: violet;
4+
font-family: Arial, Helvetica, sans-serif;
5+
font-weight: bold;
46
align-items: center;
57
text-align: center;
6-
display: flex;
78
}

63. Date Object/main.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
let date = new Date()
2+
// let year = date.getFullYear()
3+
// month = date.getMonth()
4+
// dayofmonth = date.getDate() // Day of Month
5+
// dayofweek = date.getDay()
6+
// hour = date.getHours()
7+
// minutes = date.getMinutes()
8+
// second = date.getSeconds()
9+
10+
// date = date.toLocaleString()
11+
12+
document.getElementById("mylabel").innerHTML = formatdate(date) +" "+ formattime(date)
13+
14+
15+
function formatdate(date){
16+
let year = date.getFullYear()
17+
let month = date.getMonth()
18+
let day = date.getDate()
19+
20+
return `${month}/${day}/${year}`
21+
}
22+
23+
function formattime(date){
24+
let hour = date.getHours()
25+
let minutes = date.getMinutes()
26+
let second = date.getSeconds()
27+
hour = (hour % 12) || 12
28+
if(hour >= 12){
29+
return `${hour}:${minutes}:${second} ${"pm"}`
30+
}else{
31+
return `${hour}:${minutes}:${second} ${"am"}`
32+
}
33+
}

64. Clock Program/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
11+
<label id="mylabel" class="mylabel"></label><br><br>
12+
<label id="mylabel2" class="mylabel"></label>
13+
<script src="main.js"></script>
14+
</body>
15+
</html>

64. Clock Program/main.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Clock Program = Mari kita baut program Jam bersama-sama
2+
3+
time()
4+
setInterval(time2,1)
5+
6+
function time(){
7+
let years = new Date().getFullYear()
8+
let month = new Date().getMonth()
9+
let dates = new Date().getDate()
10+
11+
document.getElementById("mylabel").innerHTML = `${years}/${month}/${dates}`
12+
}
13+
14+
function time2(){
15+
let hours = new Date().getHours()
16+
let minutes = new Date().getMinutes()
17+
if (minutes < 10){
18+
minutes = `0${minutes}`
19+
}else{
20+
minutes = minutes
21+
}
22+
let second = new Date().getSeconds()
23+
if (second < 10){
24+
second = `0${second}`
25+
}else {
26+
second = second
27+
}
28+
let millseconds = new Date().getMilliseconds()
29+
30+
31+
32+
33+
34+
document.getElementById("mylabel2").innerHTML = `${hours}:${minutes}:${second}:${millseconds}`
35+
36+
37+
38+
39+
}

64. Clock Program/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.mylabel{
2+
font-family: monospace;
3+
font-size: 4rem;
4+
color: rgb(99, 99, 163);
5+
}

64. Date Object/main.js

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
10+
11+
<script src="main.js"></script>
12+
</body>
13+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//synchronous = Synchronous code adalah kode yang dieksekusi secara berurutan,
2+
// langkah demi langkah, mulai dari atas ke bawah.
3+
// Setiap tugas harus menunggu tugas sebelumnya selesai sebelum melanjutkan
4+
5+
//Asynchronous = Asynchronous code adalah kode yang tidak menunggu tugas sebelumnya selesai
6+
// untuk melanjutkan ke langkah berikutnya.
7+
// Hal ini memungkinkan kode untuk melakukan tugas lain sambil menunggu operasi tertentu selesai.
8+
9+
const test = "Test"
10+
console.log("Start")
11+
setTimeout(() => console.log("This is Asynchronous"),4000)
12+
console.log("End")

0 commit comments

Comments
 (0)