Skip to content

Updates to the index section #321

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions lessons/full-stack-build-an-app-stars/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Then we update the display of stars:

However, if we visit a restaurant without any reviews, we will notice that we
don't see any stars! We don't see this because `restaurant.reviews.length` is
`0` and thus `averageStars` becomes `NaN`
`0`, and thus `averageStars` becomes `NaN`.

We can solve this one of two ways.

The first is to realize that `NaN` is a _false-like_ value and thus we can
The first is to realize that `NaN` is a _false-like_ value, and thus we can
rewrite the line as:

```javascript
Expand All @@ -59,7 +59,7 @@ const averageStars =
In this style, we compare the length of the review array, and if it is zero, we
set the `averageStars` to `0`, otherwise setting it equal to the average.

We can do this same change in `SingleRestaurantFromList.tsx`
We can do this same change in `SingleRestaurantFromList.tsx`.

```javascript
const totalStars = restaurant.reviews.reduce(
Expand Down