# Assignment

## Why should I even do this assignment?

Understanding the basics of Javascript is SUPER important. Therefore this assignment focuses on repeating the basics to really have a solid understanding of this.

If you struggle to do this weeks assignment, go through the last 3 weeks readme files: [Week 1: Variables](/course-content/foundation/intro-to-javascript/week1.md#variables), [Week 2: Logical Operators](/course-content/foundation/intro-to-javascript/week2.md#recap-logical-operators), [Week 3: Objects](/course-content/foundation/intro-to-javascript/week3.md#objects).

## Finishing session exercises

Finish the exercises from the session!

## CodeWars

Complete these Katas in codeWars:

* [7kyu Vowel Count](https://www.codewars.com/kata/54ff3102c1bad923760001f3)
* [7kyu Digit\*Digit](https://www.codewars.com/kata/546e2562b03326a88e000020)
* [7kyu Highest and Lowest](https://www.codewars.com/kata/554b4ac871d6813a03000035)

Post a link to your codeWars profile when you submit the assignment!

## Voice assistant

You will be building a voice assistant 🤖! Is that even possible in javascript, YES! EVERYTHING is possible in javascript 💪 (nearly)

Create a function called `getReply(command)`. The function should return a response that corresponds to the command!

These are the commands you should be able to give the voice assistant:

* `Hello my name is Benjamin` - Should save the name benjamin. and respond with "nice to meet you Benjamin". What if someone writes this twice?
* `What is my name` - should respond with the name of the person. What if the name has not yet been mentioned?
* `Add fishing to my todo` - Should respond with "fishing added to your todo". Should add fishing to a list of todos
* `Add singing in the shower to my todo` - Should add singing in the shower to a list of todos
* `Remove fishing from my todo` - Should respond with "Removed fishing from your todo"
* `What is on my todo?` - should respond with the todos. e.g. you have 2 todos - fishing and singing in the shower
* `What day is it today?` - Should respond with the date in a human readable format. E.g. if today is 30/8/2019 then it should respond with 30. of August 2019
* Should be able to do simple math. e.g. `what is 3 + 3` should respond with 6. Or `what is 4 * 12` should respond with 48
* `Set a timer for 4 minutes` - Should respond with "Timer set for 4 minutes". When 4 minutes is up: "Timer done". How do we set a timer in js? Google is your friend here!
* Add one or more command to your voice assistant

Here is an example of usage:

```js
console.log(getReply("Hello my name is Benjamin")); // "Nice to meet you benjamin"
console.log(getReply("What is my name?")); // "Your name is Benjamin"
console.log(getReply("Add fishing to my todo")); // "fishing added to your todo"
```

When you are done, add your `getReply` function and global variables to this CodeSandbox and try the voice command out with both commands and speech!

\---> <https://codesandbox.io/s/beautiful-worker-gnhbw> <## Assignment checklist

Go over your assignment one last time:

* [ ] Does every file run without errors and with the correct results?
* [ ] Have you used `const` and `let` and avoided `var`?
* [ ] Do the variable, function and argument names you created follow the [Naming Conventions](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/naming_conventions.md)?
* [ ] Is your code well-formatted (see [Code Formatting](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/code_formatting.md))?


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://program.hackyourfuture.dk/course-content/foundation/intro-to-javascript/week4/assignment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
