Skip to content

Commit

Permalink
Merge pull request #259 from ezzep66/destructuring-assig
Browse files Browse the repository at this point in the history
Destructuring assignment
  • Loading branch information
EzequielCaste authored Jul 8, 2020
2 parents 4f23a61 + 757ac91 commit b02ef3a
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Here's an example of the values after your assignment:
```js
let user = { name: "John", years: 30 };

// your code to the left side:
// tu código al lado izquierdo:
// ... = user

alert( name ); // John
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe("topSalary", function() {
it("returns top-paid person", function() {
it("devuelvo persona mejor pagada", function() {
let salaries = {
"John": 100,
"Pete": 300,
Expand All @@ -9,7 +9,7 @@ describe("topSalary", function() {
assert.equal( topSalary(salaries), "Pete" );
});

it("returns null for the empty object", function() {
it("devuelve null para objeto vacío", function() {
assert.isNull( topSalary({}) );
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 5

---

# The maximal salary
# El salario máximo

There is a `salaries` object:
Hay un objeto `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.
Crear la función `topSalary(salaries)` que devuelva el nombre de la persona mejor pagada.

- If `salaries` is empty, it should return `null`.
- If there are multiple top-paid persons, return any of them.
- Si `salaries` es vacío, debería devolver `null`.
- Si hay varias personas con mejor paga, devolver cualquiera de ellos.

P.S. Use `Object.entries` and destructuring to iterate over key/value pairs.
PD: Utilice `Object.entries` y desestructuración para iterar sobre pares de propiedades/valores.
Loading

0 comments on commit b02ef3a

Please sign in to comment.