The following files contain code that runs immediately on hard-coded variables. Refactor each of these files so that the code is reusable and portable.
For each of the .js
files in this Gist:
- enclose the relevant code inside a function (everything below the comment in each file);
- define each function so that it accepts the needed variables as arguments;
- using the
Window.prompt()
method, define your arguments based on user input; - use
Number.toFixed()
to round numbers as needed.