# Exercise: The Daily Specials

Print The Daily Grind's chalkboard of daily specials with console.log, fix a line with a mistake in it and switch a sold-out item off with a comment, and let the tests check every line.

Novice · JavaScript · Web Development · Updated November 14, 2026

By Gregor Dzierzon

The Daily Grind writes its specials on a chalkboard by the door every morning, and the owner wants the same board printed by a program, so it can go on a screen by the counter. Your job is to finish that program: one `console.log` line for each item on the board. One line is already written but has a mistake in it, and one item has sold out. Tests run your program and check every line it prints, so you'll know when the board is right.

## Get the exercise code

Open this lesson's GitHub repository, [github.com/ask-codey/exercise-javascript-daily-specials](https://github.com/ask-codey/exercise-javascript-daily-specials), also linked from the **Exercise** box beside the lesson. Clone it into your `javascript-course` folder. In a terminal, in that folder:

```bash
git clone https://github.com/ask-codey/exercise-javascript-daily-specials.git
```

Git makes a folder, `exercise-javascript-daily-specials`, with the exercise code inside. No Git on your computer? Click **Code** on the repository's page, then **Download ZIP**, and unzip it into your `javascript-course` folder instead.

The folder holds:

- `specials.js`: the chalkboard program. The comments list each special. For you to finish.
- `specials.test.js`: the tests that run your program and read what it prints. You don't need to change this file.
- `package.json`: tells Node.js how to run this folder's code and its tests. Ready to use.

In VS Code, choose **File > Open Folder** and open the exercise's folder, then open the terminal with **Terminal > New Terminal**.

## What to do

Each problem in `specials.js` is a comment with an empty line or two under it. Two examples at the top show the format:

```javascript
// Example i. The shop's name.
console.log("i) Shop: The Daily Grind");

// Example ii. The day this chalkboard is for.
console.log("ii) Today: Tuesday");
```

```text
i) Shop: The Daily Grind
ii) Today: Tuesday
```

Every line you print has the same shape: the problem number, `)`, the item's name, `: `, then its price or its value.

1. **Problems 1 to 6:** print one line for each special, under its comment, such as `1) Pumpkin Spice Latte: $5.25`.
2. **Problem 7:** a barista started this line, and it has a mistake. Run the file, read the error message, and fix the line.
3. **Problem 8:** the banana bread sold out. Turn its line into a comment, so it stays in the file for tomorrow but doesn't print today.
4. **Problem 9:** print the happy hour line, as the comment shows.

## Check your work

Run the program from the exercise folder:

```bash
node specials.js
```

The first time, it stops with an error and prints nothing: that's problem 7 at work. Then check every line with the tests:

```bash
node --test
```

At first all 11 tests fail. That's expected: each problem you finish turns its test green. A failing test's message says which problem it is and what it expected, for example *Problem 3 printed nothing. Print a line like: 3) Item name: value*. While the program has an error in it, every test fails with the same message: fix the error first, and the rest start to pass one by one.

## Hints

- **Copy the pattern.** Every line you write is shaped like the two examples, with different words. Copy one, paste it under the next comment, and change the words.
- **Read the error from the top.** The first line names the file and the line number; the line that starts with an error's name, such as `SyntaxError`, says what kind of problem it is. *Your First JavaScript Program* walks through one.
- **Count the quotes and parentheses.** Text starts and ends with a double quote, and every `(` needs its `)`.
- **Two slashes switch a line off.** `//` at the start of a line turns it into a comment. In VS Code, **Ctrl+/** (**Cmd+/** on macOS) does it for you.
- **Run it often.** Run `node specials.js` after every line or two you add, so a mistake is never far from where you're working.

## When you're done

Every test passes, and the program prints the whole chalkboard:

```text
i) Shop: The Daily Grind
ii) Today: Tuesday
1) Pumpkin Spice Latte: $5.25
2) Maple Cold Brew: $4.95
3) Hot Chocolate: $3.75
4) Blueberry Muffin: $3.25
5) Breakfast Burrito: $6.75
6) Soup of the day: Tomato Basil
7) Pastry of the day: Cinnamon Roll
9) Happy hour: 2 PM to 4 PM
```

The banana bread is back tomorrow. How would you put it back on the board, and what would you change if the shop raised its price to $3.75?

## Submit your exercise

The exercise is how you finish this lesson. When your work is done, put it on GitHub in a repo of your own, then submit that repo's address here. You don't need Git for this: you upload your files in the browser, as the lesson *Put Your Code on GitHub* (Module 1) shows screen by screen.

1. On GitHub, click **+**, then **New repository**. (No account yet? Sign up at github.com: it's free.) Name it (for example `exercise-javascript-daily-specials`), choose **Public**, turn **Add README** on so the upload button appears, and click **Create repository**. Your folder's own README replaces GitHub's when you upload it.
2. Choose **Add file**, then **Upload files**. In your exercise folder, select everything (Ctrl+A, or Cmd+A on a Mac) and drag it onto the upload area. Drag what's inside the folder, not the folder itself, so `package.json` lands at the top of your repo.
3. Under **Commit changes**, type a short note, such as *My solution*, and choose **Commit changes**.
4. Paste your repo's address, such as `https://github.com/your-name/exercise-javascript-daily-specials`, into **Submit your exercise** on this page. The site checks that the repo is public and holds your commits, and then the lesson is complete.

Changed something after you submitted? Upload the changed files again (each one replaces the file with the same name), commit, and submit again: your latest submission is the one that counts.

## So what

You wrote a program, ran it, read a real error message and fixed it, and let tests tell you when the work was right. That loop of write, run, read the message and check is how every exercise in this course works, and how professional developers work every day.

## Key terms

- [console.log()](https://www.ask-codey.com/glossary/console-log)
- [Comment](https://www.ask-codey.com/glossary/comment-javascript)
- [node Command](https://www.ask-codey.com/glossary/node-command)
- [Syntax Error](https://www.ask-codey.com/glossary/syntax-error)

## Related

- [Your First JavaScript Program](https://www.ask-codey.com/lessons/javascript-first-programs-hello-node)
- [Setup: VS Code, a Browser and Node.js](https://www.ask-codey.com/lessons/javascript-setup-vs-code-browser-and-node)
- [Put Your Code on GitHub](https://www.ask-codey.com/lessons/javascript-put-your-code-on-github)

Source: https://www.ask-codey.com/lessons/exercise-javascript-daily-specials
