Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 377 Bytes

meaningful_names.md

File metadata and controls

25 lines (18 loc) · 377 Bytes

Function names should say what they do

Bad:

function addToDate(date: Date, month: number): Date {
  // ...
}

const date = new Date();

// It's hard to tell from the function name what is added
addToDate(date, 1);

Good:

function addMonthToDate(date: Date, month: number): Date {
  // ...
}

const date = new Date();
addMonthToDate(date, 1);