|
|
|
|
|
by kretaceous
1621 days ago
|
|
Slightly tangent but one thing that these code practices articles often miss is using the language to its fullest. Most beginner developers who are not very used to the language reinvent the wheel for a lot of in-built functions. For example, I've seen stuff like: `
const arr = [];
for (let i = 0; i < anotherArray.length; i++){
arr.push(someOperationOnEachElement(anotherArray[i]))
}
` instead of `
const arr = anotherArray.map(someOperationOnEachElement)
` Not knowing what your tool/language can lead to hard-to-maintain code. One should always try to leverage the expressiveness and syntactic sugar wherever relevant. |
|