Great suggestions. Very important things for beginners to do :).
The only thing I disagree with are the comments in code.
Comments have the problem that they're easy to become outdated, because programmers may not update comments when they update code. They are also redundant if you use good names.
For example:
function foo(a, b, c = {}) {
const d = `example.com${a}`;
const e = Object.assign(c, {data});
fetch(d, e);
}
function sendData(urlSlug, data, requestConfiguration = {}) {
const absoluteURL = `example.com${urlSlug}`;
const configurationObject = Object.assign(requestConfiguration, {body: data});
fetch(absoluteURL, configurationObject);
}
What's your opinion on this? Keep up the good work! :)
Great suggestions. Very important things for beginners to do :).
The only thing I disagree with are the comments in code.
Comments have the problem that they're easy to become outdated, because programmers may not update comments when they update code. They are also redundant if you use good names.
For example:
// Here is a function, with bad names, that needs comments /* this function sends data a: url slug b: data to send c: optional configuration object */ function foo(a, b, c = {}) { const d = `example.com${a}`; // create absolute URL const e = Object.assign(c, {data}); // create new configuration object with data fetch(d, e); // send data } // Here is a good function. It doesn't need comments because the names are very descriptive function sendData(urlSlug, data, requestConfiguration = {}) { const absoluteURL = `example.com${urlSlug}`; const configurationObject = Object.assign(requestConfiguration, {body: data}); fetch(absoluteURL, configurationObject); }What's your opinion on this? Keep up the good work! :)