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

nice and simple logic! well done! #43

Open
rooberrydev opened this issue Dec 20, 2019 · 0 comments
Open

nice and simple logic! well done! #43

rooberrydev opened this issue Dec 20, 2019 · 0 comments

Comments

@rooberrydev
Copy link

your logic to figure out if someone has been good or bad is really readable, well done 💯

let goodOrBad;
let totalPoint = behaviour(questionsArray);
if (totalPoint >= 4) {
goodOrBad = true;
} else {
goodOrBad = false;
}
postData({
name: req.body.username,
behaviour: goodOrBad,
category: req.body.category
})

module.exports = array => {
const totalGoodPoints = array.reduce((acc, currNum) => {
return acc + parseInt(currNum);
}, 0);
return totalGoodPoints;
};

const goodBad = behaviour => {
if (behaviour) {
return "YOU HAVE BEEN GOOD";
} else {
return "YOU HAVE BEEN BAD";
}
};

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

No branches or pull requests

1 participant