Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sandiprayogo: Test Kawah Edukasi bath III #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions jwb1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function cariModus(arr) {
let arrModus = [];
for (let i = 0; i < arr.length; i++) {
for (let j = i + 1; j < arr.length; j++) {
if (arr[i] === arr[j]) {
arrModus.push(arr[i], arr[j]);
console.log(
"total data paling banyak keluar adalah",
arrModus[0],
"dengan jumlah ",
arrModus.length
);
}
}
}
}
cariModus([10, 4, 5, 2, 4]); // 4
12 changes: 12 additions & 0 deletions jwb2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function validation(nama) {
var validasiHuruf = /^[a-zA-Z ]+$/;
if (nama === validasiHuruf) {
console.log(
`Sistem memeriksa data anda valid dengan ketentuan kami dengan inputan${nama}`
);
} else {
console.log("Sistem kami menolak untuk inputan berisi angka" + nama);
}
}

validation("sandi");
24 changes: 24 additions & 0 deletions jwb3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// output 1:
let m = 5;
let string = "";
for (let i = 1; i <= m; i++) {
for (let j = 0; j < i; j++) {
string += "*";
}
string += "\n";
}
console.log(string);

// output 2:
let n = 5;
let string2 = "";
for (let i = 1; i <= n; i++) {
for (let j = 0; j < n - i; j++) {
string2 += " ";
}
for (let k = 0; k < i; k++) {
string2 += "*";
}
string2 += "\n";
}
console.log(string2);
8 changes: 4 additions & 4 deletions test-introduction.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Isilah data pribadi :

Nama :
Alamat Email:
Waktu Mulai :
Waktu Selesai :
Nama : sandiprayogo
Alamat Email: [email protected]
Waktu Mulai :14.00
Waktu Selesai :14.26

CARA PENGERJAAN!!!

Expand Down