Skip to content

warm up done #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

warm up done #236

wants to merge 1 commit into from

Conversation

siderdk
Copy link
Collaborator

@siderdk siderdk commented Mar 19, 2025

Apologies for the delay.

Copy link

@kiko-bkr kiko-bkr left a comment

Choose a reason for hiding this comment

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

Nice job! I really like the way you implement. I left two small comments, but other than that LGTM!

Comment on lines +6 to +8
function checkIfNumber(arg) {
return !isNaN(parseFloat(arg)) && isFinite(arg);
};
Copy link

Choose a reason for hiding this comment

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

Very nice function! 🔥

Comment on lines +10 to +13
function getAVG(args) {
const sum = args.reduce((acc, arg) => acc + parseFloat(arg), 0);
return sum / args.length;
}
Copy link

Choose a reason for hiding this comment

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

Nice! The casing of the name of the function is a bit odd though, it should be either getAvg or getAverage in my opinion.




console.log(main(args));
Copy link

Choose a reason for hiding this comment

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

What is the motivation for this console.log? You already do all the printing in the main() function itself, this line of code will either output an unncesessary undefined or a duplicate value for average, which was already printed. You can remove this.

"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node avg.js"
Copy link

Choose a reason for hiding this comment

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

As you did not need any npm dependencies for your code, there is no need to make this code into an npm package through npm init. It would have been enough to just run your code via node avg.js in the terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants