* Every time key ```'x'``` is typed then print the name of the following person in the array (```"Hi David!"```, ```"Hi Karin!"```, ```"Hi Sigrid!"```, and so forth)
//is the loop continuation condition: if the condition is true, the statement in the loop [do_something();] is executed, otherwise exit the loop when the condition is false
//is the incremental (update) statement that is executed at the end of the loop (i.e. just after the loop statement [do_something();] as been executed)
1. Modify skecth 2.1 so that every one listed in the ```NAMES``` array have all the activities listed in the ```ACTIVITIES``` array be printed out on the console when key ```'x'``` is typed (this is called a nested loop!). The console output should look something like:
let random_number = random(10); // assign a random number between 0 and 10 to variable random_number
````
Rudimentary indeed, but there are many things we can build with this simple function!
### 🤔 How to select a random element in an array?
Since we access elements of an array with indices, we can generate a random index between 0 and the length of an array so to select a random element in it.
The first problem we have to solve is that the ```random``` functions generates a "real" number (ex: 4.993319470244624, 1.9486631456631776, 7.1841821754535813, etc.) while the indices of an array are "integer" numbers (5, 2, 7, etc.).
We thus need to round the "real" numbers produced by random (4.993319470244624 -> 5, 1.9486631456631776 -> 2, 7.1841821754535813 -> 7). We do this with the ```Math.floor``` function:
This will work, but it is not "elegant"... We have here two variables (```random_index_names```, ```random_index_activities```) that are assigned a random value with the respective arrays' length (```NAMES.length```, ```ACTIVITIES.length```). What if we had many arrays? We would need as many variables as there are arrays to select from right? The code would be very long!
1. Modify sketch 2.2 by adding a day of the week when an activity is taking place. For example:
```
David likes to play records with Karin on Tuesday
```
2. Come up with your own random sentences! Remember you can add as many arrays to select from as you want and most languages are structured "systems" having nouns, verb, adjectives, adverbs, etc. Here is what I came up with (can you guess what my code looks like?):
```
Laura wears a blue sweater when Sigrid plays tennis
Karin wears a black cap when Karin plays records
Laura wears a yellow scarf when Nanna plays piano
Karin wears a yellow jacket when Sigrid plays chess
Nanna wears a orange sweater when Nanna plays tennis
Karin wears a black jacket when Maaike plays chess