Disneyland for procrastinators and lazy people.
This project is ideal for avoiding someone annoying; it takes no more than 20 lines of code and can save you for the rest of your life!
We wanted a project that used very little Javascript but still, with a very fun application, the excuse generator takes 20 lines of code, is super simple to understand, and is the perfect first-ish project for any beginner developer.
- Make sure you have a Github account at: https://github.com
- We recommend opening this repository using a provisioning tool like Codespaces (recommended) or Gitpod. Alternatively, you can clone it on your local computer using the
git clone
command.
This is the repository you need to open or clone:
https://github.com/breatheco-de/excuse-generator-javascript-cli
👉 Please follow these steps on how to start a coding project.
- The exercises will start and show the instructions automatically, but if you encounter any issues you can try running them manually by typing in your command line the following:
$ learnpack start
Please create a Javascript script that generates an excuse each time it is run.
How can we generate an excuse? How are sentences built?
The idea is to generate each part of the sentence randomly to come up with great excuses!
- Create an
app.py
file with one excuse hard-coded in one variable. - The excuse must be in a variable:
excuse = 'The dog eat my homework when I finished'
- Using Javascript, create a function that generates and returns a random excuse with the following structure:
let who = ['the dog','my granma','his turtle','my bird'];
let what = ['eat','pissed','crushed','broked'];
let when = ['before the class','right in time','when I finished','during my lunch','while I was praying'];
- To create a consistent excuse, you have to concatenate one item from each array in the proper order.
- Print the excuse on the console using the
console.log()
function.
Javascript.
This exercise covers the following fundamentals:
- Running Javascript files.
- How to work with Arrays.
- Generating random numbers.
- Concatenating strings.
- Using functions (at least a bit).