151
152function formatDate(date: Date) {
153 if (!date) return '';
154 const d = new Date(date),155 month = '' + (d.getMonth() + 1),
156 day = '' + d.getDate(),
157 year = d.getFullYear();
144);
145
146function pad(num: string, size: number): string {
147 let s = num + "";148 while (s.length < size) s = "0" + s;
149 return s;
150}
Single character variable names affect code readability and complicate code refactoring, because of the difficulty in searching and replacing single characters.
This issue will not be raised for certain special identifiers, such as i
, j
or n
. It will also not be reported for the parameters used in for
and while
loops.
var a;
const l = 90
var age;
const limit = 90;
for(let o = 2; o < 10; o++){
sum += o
}