Loading...
Loading...
Function design patterns emphasizing single responsibility and clarity.
npx skill4agent add damianwrooby/javascript-clean-code-skills clean-codejs-functions// ❌ Bad
function handleUser(user) {
saveUser(user);
sendEmail(user);
}
// ✅ Good
function saveUser(user) {}
function notifyUser(user) {}// ❌ Bad
function createUser(name, age, city, zip) {}
// ✅ Good
function createUser({ name, age, address }) {}// ❌ Bad
let total = 0;
function add(value) {
total += value;
}
// ✅ Good
function add(total, value) {
return total + value;
}