Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

##Naming##

Using single-letter variable names is bad, and there is absolutely no reason to use them as we aren't limited on name length anymore. Looking through your code, I still don't know what a, b, i, j, m, and the like mean, what they are, or what they do. Using descriptive names would tell me what they do so I could understand the code even if I didn't know JavaScript. Also, if you use good names, you won't need to give a comment stating what the variable is, does, or contains. Good code doesn't need a whole lot of comments. In fact, most of the comments I see are like this:

catch
{
 // gotcha!
}

##Sorting##

var l = [ a[j].id, b[k].id ].smartSort('a');
var f = [ a.tagName, b.tagName ].smartSort('d');

I assume 'a' and 'd' are specifying which way to sort the collection of items. You should avoid passing text values to specify what your program should do. In this case, I would pass a Boolean value, but you can define enums in JavaScript you can define enums in JavaScript too.

##Functions##

You don't need to all related code in one function. You should split your code up into more functions. This also makes it easier to pinpoint bugs, fix them without introducing more bugs, and helps prevent violation of SRP and creation of megamoths.

##Naming##

Using single-letter variable names is bad, and there is absolutely no reason to use them as we aren't limited on name length anymore. Looking through your code, I still don't know what a, b, i, j, m, and the like mean, what they are, or what they do. Using descriptive names would tell me what they do so I could understand the code even if I didn't know JavaScript. Also, if you use good names, you won't need to give a comment stating what the variable is, does, or contains. Good code doesn't need a whole lot of comments. In fact, most of the comments I see are like this:

catch
{
 // gotcha!
}

##Sorting##

var l = [ a[j].id, b[k].id ].smartSort('a');
var f = [ a.tagName, b.tagName ].smartSort('d');

I assume 'a' and 'd' are specifying which way to sort the collection of items. You should avoid passing text values to specify what your program should do. In this case, I would pass a Boolean value, but you can define enums in JavaScript too.

##Functions##

You don't need to all related code in one function. You should split your code up into more functions. This also makes it easier to pinpoint bugs, fix them without introducing more bugs, and helps prevent violation of SRP and creation of megamoths.

##Naming##

Using single-letter variable names is bad, and there is absolutely no reason to use them as we aren't limited on name length anymore. Looking through your code, I still don't know what a, b, i, j, m, and the like mean, what they are, or what they do. Using descriptive names would tell me what they do so I could understand the code even if I didn't know JavaScript. Also, if you use good names, you won't need to give a comment stating what the variable is, does, or contains. Good code doesn't need a whole lot of comments. In fact, most of the comments I see are like this:

catch
{
 // gotcha!
}

##Sorting##

var l = [ a[j].id, b[k].id ].smartSort('a');
var f = [ a.tagName, b.tagName ].smartSort('d');

I assume 'a' and 'd' are specifying which way to sort the collection of items. You should avoid passing text values to specify what your program should do. In this case, I would pass a Boolean value, but you can define enums in JavaScript too.

##Functions##

You don't need to all related code in one function. You should split your code up into more functions. This also makes it easier to pinpoint bugs, fix them without introducing more bugs, and helps prevent violation of SRP and creation of megamoths.

Source Link
user34073
user34073

##Naming##

Using single-letter variable names is bad, and there is absolutely no reason to use them as we aren't limited on name length anymore. Looking through your code, I still don't know what a, b, i, j, m, and the like mean, what they are, or what they do. Using descriptive names would tell me what they do so I could understand the code even if I didn't know JavaScript. Also, if you use good names, you won't need to give a comment stating what the variable is, does, or contains. Good code doesn't need a whole lot of comments. In fact, most of the comments I see are like this:

catch
{
 // gotcha!
}

##Sorting##

var l = [ a[j].id, b[k].id ].smartSort('a');
var f = [ a.tagName, b.tagName ].smartSort('d');

I assume 'a' and 'd' are specifying which way to sort the collection of items. You should avoid passing text values to specify what your program should do. In this case, I would pass a Boolean value, but you can define enums in JavaScript too.

##Functions##

You don't need to all related code in one function. You should split your code up into more functions. This also makes it easier to pinpoint bugs, fix them without introducing more bugs, and helps prevent violation of SRP and creation of megamoths.

default

AltStyle によって変換されたページ (->オリジナル) /