Skip to content

Instantly share code, notes, and snippets.

@ahhzaky
Last active March 8, 2023 12:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ahhzaky/ac335d7f62159e94fbc1819209f9e5c7 to your computer and use it in GitHub Desktop.
Save ahhzaky/ac335d7f62159e94fbc1819209f9e5c7 to your computer and use it in GitHub Desktop.
Coding test object
/**
* 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 };
@widhiyupyup
Copy link

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment