Created
January 18, 2023 14:59
-
-
Save AsadSaleh/622923deb2aedd05d55d575b46848315 to your computer and use it in GitHub Desktop.
gas pollll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Buat fungsi "calculateDiscountedPrice" yang menerima number, lalu mengembalikan number | |
// dengan value yang sudah dipotong 20% dari harga aslinya. | |
function calculateDiscountedPrice(inputNumber) { | |
return; // todo | |
} | |
// 2. Buat fungsi "convertIntoDiscountedItem" yang menerima input berbentuk { name:string, price:number } | |
// lalu menghasilkan output { name:string, price:number } (sama) dengan property price-nya dipotong 20% | |
function convertIntoDiscountedItem(inputObj) { | |
return; //todo | |
} | |
// 3. Nah, sekarang ubah "arrayOfItems" dibawah ini menjadi "discountedArrayOfItems" baru dengan | |
// harga yang sudah di diskon 20%. | |
// Tips: Gunakan Array.map. | |
const arrayOfItems = [ | |
{ | |
name: "MG Gundam Barbatos", | |
price: 1_000_000, | |
}, | |
{ | |
name: "MG Gundam Wing Ver.Ka", | |
price: 1_200_000, | |
}, | |
{ | |
name: "MG Gundam Dynames", | |
price: 700_000, | |
}, | |
]; | |
const discountedArrayOfItems = []; // todo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment