curriculum icon indicating copy to clipboard operation
curriculum copied to clipboard

Clean Code: Example uses Array.forEach() before arrays are introduced

Open Asartea opened this issue 1 year ago • 1 comments

Checks

Describe your suggestion

In the first set of examples of the What is clean code section of the Clean code lesson TOP uses this example:

const sumArray = function (array) {
  let sum = 0;
  array.forEach(function (number) {
    sum += number;
  });
  return sum;
};

sumArray([2, 2, 2]);

Arrays (and loops) however, are not covered until two lessons later; the learner who is following the curriculum would at this point have no way to understand what this code is doing. The example should probably just be rewritten to convey the same point using code already taught

Path

Foundations

Lesson Url

https://www.theodinproject.com/lessons/foundations-clean-code

(Optional) Discord Name

asarta

(Optional) Additional Comments

No response

Asartea avatar Feb 14 '24 15:02 Asartea

Edit: Self-assigning as Asarta has not specified they wish to work on this and no one has responded for 2 weeks.

~~If Asarta doesn't want to work on this, given no one's responded for 2 weeks, I'll happily work on it if approved for assignment.~~

MaoShizhong avatar Feb 26 '24 10:02 MaoShizhong

I can work on this if you don't have time.

cakegod avatar Mar 01 '24 19:03 cakegod

Was actually waiting for a style guide PR to be merged to make things a little easier, seems it was merged the other day. I ended up taking on a bit of a longer mundane task right now, so sure thing I'll hand this over to you @cakegod Much appreciated :+1:

MaoShizhong avatar Mar 01 '24 20:03 MaoShizhong