Skip to content

Destructuring assignment #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 5

---

# Destructuring assignment
# Destrukturisasi penugasan

We have an object:
Kita mempunyai sebuah objek:

```js
let user = {
Expand All @@ -13,18 +13,18 @@ let user = {
};
```

Write the destructuring assignment that reads:
Tulis destrukturisasi penugasan yang terbaca:

- `name` property into the variable `name`.
- `years` property into the variable `age`.
- `isAdmin` property into the variable `isAdmin` (false, if no such property)
- `name` properti menjadi variabel `name`.
- `years` properti menjadi variabel `age`.
- `isAdmin` properti menjadi variabel `isAdmin` (false, jika tidak ada properti seperti itu)

Here's an example of the values after your assignment:
Berikut adalah contoh nilai setelah penugasan Anda:

```js
let user = { name: "John", years: 30 };

// your code to the left side:
// kode Anda ke sisi kiri:
// ... = user

alert( name ); // John
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
importance: 5
nilai penting: 5

---

# The maximal salary
# Gaji maksimal

There is a `salaries` object:
Ada objek `salaries`:

```js
let salaries = {
Expand All @@ -14,9 +14,9 @@ let salaries = {
};
```

Create the function `topSalary(salaries)` that returns the name of the top-paid person.
Buatlah fungsi `topSalary(salaries)` yang mengembalikan nama orang dengan bayaran tertinggi.

- If `salaries` is empty, it should return `null`.
- If there are multiple top-paid persons, return any of them.
- Jika `gaji` kosong, itu harus mengembalikan` null`.
- Jika ada beberapa orang bergaji tinggi, kembalikan salah satu dari mereka.

P.S. Use `Object.entries` and destructuring to iterate over key/value pairs.
N.B. Gunakan `Object.entries` dan destrukturisasi untuk meng-iterasi lewat pasangan kunci/nilai.
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy