Skip to content

Mareh A.#18

Open
mareh-aboghanem wants to merge 1 commit intoHackYourAssignment:mainfrom
mareh-aboghanem:main
Open

Mareh A.#18
mareh-aboghanem wants to merge 1 commit intoHackYourAssignment:mainfrom
mareh-aboghanem:main

Conversation

@mareh-aboghanem
Copy link

No description provided.

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

📝 HackYourFuture auto grade

Assignment Score: 0 / 100 ✅

Status: ✅ Passed
Minimum score to pass: 0
🧪 The auto grade is experimental and still being improved

Test Details

@sycons sycons self-assigned this Feb 8, 2026
@mareh-aboghanem mareh-aboghanem changed the title Mareh S. Mareh A. Feb 11, 2026
Copy link

@sycons sycons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following were implemented:

  • Setup & configure project ✅
  • Create a transactions array ✅
  • Implement required functions ✅
  • Implement display requirements ✅
  • Display summary report ✅
  • Code quality ✅

Good job in implementing the requirements ⭐

There are some minor improvements that I have left more info about in the comments.

  • Use ES Modules way.
  • Remove invalid comments
  • Use javascript statements like for...of

}
];

module.exports = transactions;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export default transactions; is more common to use than module.exports = transactions

The way you've done it is the older CommonJS Module way. The newer way is to use export which is ES Modules way.

More info on the history: https://www.w3schools.com/nodejs/nodejs_modules_esm.asp

const transactions = require('./data.js');
const chalk = require('chalk');
function addTransaction(transaction) {
// TODO: Implement this function
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code clean up: Remove these TODO statements. Now that you have implemented the code, these are not relevant anymore.

function getTotalIncome() {
// TODO: Implement this function
let total = 0;
for (let i = 0; i < transactions.length; i++) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This for loop is perfectly fine and works. But you can also use the for...of loop as well. This makes the code more readable and removes the need to use a variable i to keep track of the index.

Learn more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of

// TODO: Implement this function
let total = 0;
//for(const transaction of transactions)
for (let i = 0; i < transactions.length; i++) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for...of loop can also be used here.

function getTransactionsByCategory(category) {
// TODO: Implement this function
const result = [];
for (let i = 0; i < transactions.length; i++) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for...of loop can also be used here.


for (let i = 0; i < transactions.length; i++) {
const transaction = transactions[i];
const { id, type, description, amount, category } = transaction;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good use of object destructuring ⭐

@@ -0,0 +1,4 @@
const { printAllTransactions, printSummary } = require('./finance.js');

printAllTransactions();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this is fine to use run.js as the entry point of the app, usually app.js is used as the entry point.

console.log(chalk.bold(`Total Transactions : ${transactionCount}`));
}

function removeTransaction(id) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done on implementing a bonus challenge ⭐

@sycons sycons added Reviewed This assignment has been reivewed by a mentor and a feedback has been provided and removed To review labels Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants