DEV Community

Discussion on: Stop Using "data" as a Variable Name

Collapse
 
mrdulin profile image
official_dulin • Edited

If undefined is a meaningful value, replace it with a variable. E.g. We will do something if scoreType is all.

Bad

if (scoreType === undefined) {
  // do something
} 
Enter fullscreen mode Exit fullscreen mode

Good:

const all = undefined;
if(scoreType === all) {
  // do something
}
Enter fullscreen mode Exit fullscreen mode