Writing clean code
There are many different opinions on what constitutes great JavaScript code, but there are several things you can do to ensure that yours is hopefully easy for others to read.
The importance of clean code
const x =
function(z) {
let w = 0;z.forEach(
function(q){
w += q;
});return w;
};
x([2, 2, 2]);const sumArray = function(array) {
let sum = 0;
array.forEach(function(number) {
sum += number;
});
return sum;
};
sumArray([2, 2, 2]);Rules of thumb
Assignment
Additional resources
Last updated