Skip to content
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

Add solution for #68 in javascript. #128

Merged

Conversation

sylvain1811
Copy link
Contributor

@sylvain1811 sylvain1811 commented Oct 7, 2019

I've solved #68 in javascript. It's working with node v12.9.1.

function checkout_time(customers, n_cashier) {
let cashiers = Array(n_cashier).fill(0)
customers.forEach(customer => {
minIndex = cashiers.reduce((accIdx, current, index) => {
Copy link
Owner

Choose a reason for hiding this comment

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

consider declaring this as a const or let instead of as a global variable (for scope safety)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I forgot about that! Thanks for your feedbak!

return Math.max(...cashiers)
}

function test() {
Copy link
Owner

Choose a reason for hiding this comment

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

nice work building in your own test runner! you might be interested in the node assert module that comes in the standard lib. you can read more about it here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will take a look, thanks!

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