Last active
March 8, 2023 12:09
-
-
Save ahhzaky/ac335d7f62159e94fbc1819209f9e5c7 to your computer and use it in GitHub Desktop.
Coding test object
This file contains 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
/** | |
* TODO | |
* 1. Buatlah variabel dengan nama restaurant yang object dengan ketentuan berikut: | |
* - Memiliki properti bernama "name" | |
* - Bertipe data string | |
* - Bernilai apa pun, asalkan tidak string kosong atau null. | |
* - Memiliki properti bernama "city" | |
* - Bertipe data string | |
* - Bernilai apa pun, asalkan tidak string kosong atau null. | |
* - Memiliki properti "favorite drink" | |
* - Bertipe data string | |
* - Bernilai apa pun, asalkan tidak string kosong atau null. | |
* - Memiliki properti "favorite food" | |
* - Bertipe data string | |
* - Bernilai apa pun, asalkan tidak string kosong atau null. | |
* - Memiliki properti "isVegan" | |
* - Bertipe data boolean | |
* - Bernilai boolean apa pun. | |
* | |
* 2. Buatlah variabel bernama name. | |
* Kemudian isi dengan nilai name dari properti object restaurant | |
* 3. Buatlah variabel bernama favoriteDrink. | |
* Kemudian isi dengan nilai "favorite drink" dari properti object restaurant | |
*/ | |
// TODO | |
const restaurant = { | |
name:"Ahmad", | |
city:"banda", | |
"favorite drink":"cola", | |
"favorite food":"sirup", | |
"isVegan":true | |
} | |
const {name} = restaurant; | |
const {'favorite drink': favoriteDrink } = restaurant; | |
console.log(name); | |
console.log(favoriteDrink); | |
/** | |
* Hiraukan kode di bawah ini | |
*/ | |
module.exports = { restaurant, name, favoriteDrink }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good