Skip to content

Commit 10ab7d7

Browse files
committed
function
1 parent 4388ee4 commit 10ab7d7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

yourPlayground.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// makanan = parseInt(prompt("harga makanan yang kamu beli?"));
2+
// diskon = parseFloat(prompt("Paket diskon yang kamu ambil? %") / 100);
3+
4+
// bayar = makanan * diskon;
5+
// totalBayar = makanan + bayar;
6+
7+
// alert("harga yang kamu bayar " + totalBayar);
8+
9+
function calculateFoodTotal(food, tip) {
10+
tipPercentage = tip / 100;
11+
tipAmount = food * tipPercentage;
12+
total = sum(food, tipAmount);
13+
return total;
14+
}
15+
16+
console.log(calculateFoodTotal(100, 20));
17+
18+
const groceries = ["🍌", "🍎", "🍊", "🍐"];
19+
groceries.push("🍪");
20+
groceries.unshift("😎");
21+
22+
console.log(groceries);
23+
const showSlice = groceries.slice(1, 4);
24+
console.log(showSlice);

0 commit comments

Comments
 (0)