Skip to content

Commit 965b871

Browse files
committed
Simplify exercise 4.5 assignment
1 parent 3f2b5d0 commit 965b871

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

src/content/4/en/part4a.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -724,17 +724,7 @@ You are bound to run into problems while writing tests. Remember the things that
724724
725725
#### 4.5*: Helper Functions and Unit Tests, step 3
726726
727-
Define a new _favoriteBlog_ function that receives a list of blogs as a parameter. The function finds out which blog has the most likes. If there are many top favorites, it is enough to return one of them.
728-
729-
The value returned by the function could be in the following format:
730-
731-
```js
732-
{
733-
title: "Canonical string reduction",
734-
author: "Edsger W. Dijkstra",
735-
likes: 12
736-
}
737-
```
727+
Define a new _favoriteBlog_ function that receives a list of blogs as a parameter. The function returns the blog with the most likes. If there are multiple favorites, it is sufficient for the function to return any one of them.
738728
739729
**NB** when you are comparing objects, the [deepStrictEqual](https://nodejs.org/api/assert.html#assertdeepstrictequalactual-expected-message) method is probably what you want to use, as it ensures that the objects have the same attributes. For differences between various assert module functions, you can refer to [this Stack Overflow answer](https://stackoverflow.com/a/73937068/15291501).
740730

src/content/4/fi/osa4a.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -712,17 +712,7 @@ Törmäät testien tekemisen yhteydessä varmasti erinäisiin ongelmiin. Pidä m
712712
713713
#### 4.5*: apufunktioita ja yksikkötestejä, step3
714714
715-
Määrittele funktio _favoriteBlog_, joka saa parametrikseen taulukollisen blogeja. Funktio selvittää millä blogilla on eniten tykkäyksiä. Jos suosikkeja on monta, riittää että funktio palauttaa niistä jonkun.
716-
717-
Paluuarvo voi olla esim. seuraavassa muodossa:
718-
719-
```js
720-
{
721-
title: "Canonical string reduction",
722-
author: "Edsger W. Dijkstra",
723-
likes: 12
724-
}
725-
```
715+
Määrittele funktio _favoriteBlog_, joka saa parametrikseen taulukollisen blogeja. Funktio palauttaa blogin, jolla on eniten tykkäyksiä. Jos suosikkeja on monta, riittää että funktio palauttaa niistä jonkun.
726716
727717
**HUOM.** Kun vertailet olioita, haluat luultavimmin käyttää [deepStrictEqual](https://nodejs.org/api/assert.html#assertdeepstrictequalactual-expected-message)-metodia, sillä se tarkistaa, että olioilla on samat attribuutit. Assert-moduulin eri metodeista voit lukea lisää esimerkiksi [tästä Stack Overflow -vastauksesta](https://stackoverflow.com/a/73937068/15291501).
728718

0 commit comments

Comments
 (0)