Hey,
Great job from your end. I prefer functional programming.Maybe because I have a Maths background and I dread for loops😉
One advice to make it easier for you to remember and also make your code more readable.
For example your filter should look something like this:
const evenNumbers = numbers.filter(number => number %2 === 0)
Just naming your variable correctly reduces the confusion.
One, you know the filter is returning even numbers. Also, it will quickly stick that you are just iterating over numbers and checking if each number is even. That way that variable wouldn't look made up. It will make perfect sense.
Hey,
Great job from your end. I prefer functional programming.Maybe because I have a Maths background and I dread for loops😉
One advice to make it easier for you to remember and also make your code more readable.
For example your filter should look something like this:
const evenNumbers = numbers.filter(number => number %2 === 0)
Just naming your variable correctly reduces the confusion.
One, you know the filter is returning even numbers. Also, it will quickly stick that you are just iterating over
numbers
and checking if eachnumber
is even. That way that variable wouldn't look made up. It will make perfect sense.Best wishes.
Excellent contribution! I actually like to have this in hand, to remind me of that kind of stuff.
cheatography.com/costemaxime/cheat...