Conversation
📝 HackYourFuture auto gradeAssignment Score: 0 / 100 ✅Status: ✅ Passed Test Details |
sycons
left a comment
There was a problem hiding this comment.
Following were implemented:
- Setup & configure project ✅
- Create a transactions array ✅
- Implement required functions ✅
- Implement display requirements ✅
- Display summary report ✅
You've done a good job in implementing the requirements and using javascript well.
There are some minor improvements that I have left more info in the comments.
- Use ES Modules way.
- Remove invalid comments
- Some code formatting
- Use additional javascript features like object destructuring
| }, | ||
| ]; | ||
|
|
||
| module.exports = transactions; No newline at end of file |
There was a problem hiding this comment.
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
|
|
||
|
|
||
| function addTransaction(transaction) { | ||
| // TODO: Implement this function |
There was a problem hiding this comment.
Code clean up: Remove these TODO statements. Now that you have implemented the code, these are not relevant anymore.
| } | ||
|
|
||
| function printSummary(){ | ||
| const totalIncome = getTotalIncome(); |
There was a problem hiding this comment.
Formatting: The code inside this function should be indented.
| console.log(chalk.bold('All transactions')); | ||
|
|
||
| for(const transaction of transactions){ | ||
| const amountColor = transaction.type === 'income' |
There was a problem hiding this comment.
One of the requirements is to use object destructuring. How you've implemented it works perfectly fine. This is just an opportunity to try it out and learn more about it.
More info: https://javascript.info/destructuring-assignment#object-destructuring
No description provided.