-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercise-9.js
47 lines (39 loc) · 920 Bytes
/
exercise-9.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*****************
* Tugas 1
*/
function shoutOut() {
return 'Halo Function!';
}
console.log(shoutOut());
/*****************
* Tugas 2
*/
function calculateMultiply(num1, num2) {
return num1 * num2;
}
var num1 = 5;
var num2 = 6;
var hasilPerkalian = calculateMultiply(num1, num2);
console.log(hasilPerkalian); // Menampilkan angka 30
/*****************
* Tugas 3
*/
function processSentence(name, age, address, hobby) {
return (
'Nama saya ' +
name +
', umur saya ' +
age +
' tahun, alamat saya di ' +
address +
', dan saya punya hobby yaitu ' +
hobby +
'!'
);
}
var name = 'Agus';
var age = 30;
var address = 'Jln. Malioboro, Yogjakarta';
var hobby = 'gaming';
var fullSentence = processSentence(name, age, address, hobby);
console.log(fullSentence); // Menampilkan "Nama saya Agus, umur saya 30 tahun, alamat saya di Jln. Malioboro, Yogjakarta, dan saya punya hobby yaitu gaming!"