airbnb / airbnb/javascript

separate event handler functions for an event attached to different inputs or one event handler function with lot of if statements/ switch statement?

Open
#1,783 1 comment 1 reaction 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
148k
Forks
26.6k
PR merge metrics
No merged PRs in 30d

Description

separate event handler functions for an event attached to different inputs or one event handler function with lot of if statements/ switch statement?

```js
// event handler 1
function validateEmail() {
// validate email here
}

// event handler 2
function validatePassword() {
//validate password here
}

// or

// generic event handler
function validateFields() {
/*
if(is email){
validate email
}

if(is password) {
validate password
}
*/
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue presents two JavaScript event-handler patterns but names no file, test, or entry point to inspect. First determine whether the style guide should document a preferred pattern; the issue provides no concrete acceptance condition for when the work would be done.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.