Authored by Max Brockabnk
Updated on Feb 1th, 2021
Takes in user input, creating a new object whose methods calculate how old you would be in terms of other planets years. Utilizes JavaScript classes and class methods, template literals, and the NPM package Jest for testing and using TDD concepts.
- Modern Browser
- Text editor
- Node.js
- Clone this repo to your desktop
- Run
npm install to get node modules
- Run
npm run start
to start development server and view in the broweser
- JavaScript/jQuery
- NPM/Webpack/Jest
- UI has no validation so you could submit the form without any input and get the response text back with NaN where ages should be and no name filled in.
Behavior | Input | Output |
---|---|---|
1. Create new instance of the Galactic_Age class, passing in user's name and age | Greg, 21 | object.values(greg) = ["Greg", 21] |
2. Accuratley produce input age in Mercury years, which is about 88 Earth days per solar year, rounded down to nearest whole number. | greg.mercuryAge = 87 | |
3. Accuratley produce input age in Venus years, which is about 225 Earth days per solar year, rounded down to nearest whole number. | greg.venusAge = 34 | |
4. Accuratley produce input age in Mars years, which is about 687 Earth days per solar year, rounded down to nearest whole number. | greg.marsAge = 11 | |
5. Accuratley produce input age in Jupiter years, which is about 4,333 Earth days per solar year, rounded down to nearest whole number. | greg.jupiterAge = 1 | |
6. Add average life expectancy of about 72 years as estimated by the UN in 2019, as expectedLife property to Galactic_Age class constructor | greg.expectedLife = 72 | |
7. Check life expectancy against different planet ages and return proper response | greg.mercuryAge | "15 years past life expectancy" |
8. Allow user to adjust life expectancy property, this will be another adjustment to the existing test for spec #1. |
- Copyright © 2020 Max Brockbank
- This software is licensed under the MIT license