cyberrie / Console-Finances

This is JavaScript code for analyzing the financial records of a company. It calculates the total number of months, net profit/loss, average changes and max profit/ max loss over a period of time. 🤑

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Console Finances

Overview

This is JavaScript code for analyzing the financial records of a company, containing month/year and the amount.

It calculates each of the following:

  • The total number of months included in the dataset.

  • The net total amount of Profit/Losses over the entire period.

  • The average of the changes in Profit/Losses over the entire period:

    • Calculated by finding the change in profits from month to month and then the average of that
  • The greates increase in profit (date and amount) over the entire period

  • The greatest decrease in losses (date and amount) over the entire period

Expected Console Output

The final code prints the analysis to browser console, as below:

Financial Analysis
Total Months: 86
Total: $38382578
Average  Change: $-2315.12
Greatest Increase in Profits: Feb-2012 ($1926159)
Greatest Decrease in Profits: Sep-2013 ($-2196167)

Screenshot of the Console Output

console-finances

Links

  1. Click on this link to access the Live Server: Console Finances

  2. Press Command+Option+J (Mac) or Control+Shift+J (Windows, Linux, ChromeOS) to open the Console

My Process

  • Pseudocode written first and is also visible in the comments sections throughout my code
  • Code brokend down in smaller sections initially and then joined together
  • Console.log used throughout to test the output
  • Searate for loops used for average changes, max profit and max loss but refactored when completed

Built with...

  • JavaScript

What I learned

  • For loop iteration through nested array
  • Selection of the appropriate array elements and performing neccessary operations
  • separate for loops used initially for total average change, max profit and max loss but refactored when completed

Useful Resources

Author

©️ Helena Gilja

License

N/A

About

This is JavaScript code for analyzing the financial records of a company. It calculates the total number of months, net profit/loss, average changes and max profit/ max loss over a period of time. 🤑


Languages

Language:JavaScript 93.5%Language:HTML 6.5%