Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

###arr.forEach

arr.forEach

I would consider using a simple for loop to iterate over the elArr (perhaps consider a bit better name, like elementsArray or just elements). This StackOverflow post goes over some of the benefits of doing this.

You can also use the disabled attribute directly.

for (let i = 0; i < elArr.length; i++) {
 elArr[i].disabled = true; // or false to remove it
});

I would also personally prefer to have a boolean argument like isToggled instead of expecting a string, so you can do something like below. In my opinion a boolean is less likely to result in an error (e.g. a misspelled string).

if (isToggled) {
 ...
} else {
 ...
}

The comment // inputs doesn't really achieve anything, I would suggest to remove it completely.

###arr.forEach

I would consider using a simple for loop to iterate over the elArr (perhaps consider a bit better name, like elementsArray or just elements). This StackOverflow post goes over some of the benefits of doing this.

You can also use the disabled attribute directly.

for (let i = 0; i < elArr.length; i++) {
 elArr[i].disabled = true; // or false to remove it
});

I would also personally prefer to have a boolean argument like isToggled instead of expecting a string, so you can do something like below. In my opinion a boolean is less likely to result in an error (e.g. a misspelled string).

if (isToggled) {
 ...
} else {
 ...
}

The comment // inputs doesn't really achieve anything, I would suggest to remove it completely.

arr.forEach

I would consider using a simple for loop to iterate over the elArr (perhaps consider a bit better name, like elementsArray or just elements). This StackOverflow post goes over some of the benefits of doing this.

You can also use the disabled attribute directly.

for (let i = 0; i < elArr.length; i++) {
 elArr[i].disabled = true; // or false to remove it
});

I would also personally prefer to have a boolean argument like isToggled instead of expecting a string, so you can do something like below. In my opinion a boolean is less likely to result in an error (e.g. a misspelled string).

if (isToggled) {
 ...
} else {
 ...
}

The comment // inputs doesn't really achieve anything, I would suggest to remove it completely.

Source Link
Phrancis
  • 20.5k
  • 6
  • 69
  • 155

###arr.forEach

I would consider using a simple for loop to iterate over the elArr (perhaps consider a bit better name, like elementsArray or just elements). This StackOverflow post goes over some of the benefits of doing this.

You can also use the disabled attribute directly.

for (let i = 0; i < elArr.length; i++) {
 elArr[i].disabled = true; // or false to remove it
});

I would also personally prefer to have a boolean argument like isToggled instead of expecting a string, so you can do something like below. In my opinion a boolean is less likely to result in an error (e.g. a misspelled string).

if (isToggled) {
 ...
} else {
 ...
}

The comment // inputs doesn't really achieve anything, I would suggest to remove it completely.

default

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