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.
Both the Tip Calculator and the GST Calculator deal with rates and percentages.
- In a separate file, write a function that will convert a rate (i.e. 0.05) into a percentage (5%as a string).
- Add this new file to index.htmlabove the files that will use it.- Note: you will need to use returnkeyword to pass the new percentage string back to the main script.
 
- Note: you will need to use 
- Refactor the Tip Calculator to use your function.
- Refactor the GST Calculator to use your function and include the GST percentage in its response like the Tip Calculator does.