Freecodecamp: Object Oriented and Functional Programming DESPERATELY needs rewrite!

Created on 27 Jun 2016  ·  5Comments  ·  Source: freeCodeCamp/freeCodeCamp

Challenge Iterate over Arrays with map has an issue.

The description of this waypoint is completely inadequate. It reads:

The map method is a convenient way to iterate through arrays. Here's an example usage:

var timesFour = oldArray.map(function(val){
 return val * 4;
});

The map method will iterate through every element of the array, creating a new array with values that have been modified by the callback function, and return it. Note that it does not modify the original array.

In our example the callback only uses the value of the array element (the val argument) but your callback can also include arguments for the index and array being acted on.

It does not really explain the syntax, what results the map method produces and requires readers to speak CSspeak and decipher many implicit unstated things.

I am struggling to understand anything in the section _Object Oriented and Functional Programming_, not because the concepts are difficult but because the lessons are poorly constructed. I'm referring to Crockford, Eloquent JS and Codeacademy to provide information written in a manner that I _can_ understand.

Forgive my shortness, I just hope that my suggestion that this need a rewrite is taken up.

first timers only help wanted

Most helpful comment

I think that the challenge is clear enough
...and at this point we should be familiar with the Read-Search-Ask

All 5 comments

/cc @FreeCodeCamp/issue-moderators

Again as mentioned in #9404 we could have supplementary MDN links however let's see how this can be re-written?

I think that the challenge is clear enough
...and at this point we should be familiar with the Read-Search-Ask

@manicmarvin thanks for the feedback. Maybe we can expand the example code a bit to show what the oldArray is and what the .map function returns.

var oldArray = [1, 2, 3];
var timesFour = oldArray.map(function(val){
  return val * 4;
});
console.log(timesFour); // returns [4, 8, 12]
console.log(oldArray);  // returns [1, 2, 3]

This line needs to be changed to

"<blockquote>var oldArray = [1, 2, 3];<br>var timesFour = oldArray.map(function(val){<br>&nbsp;&nbsp;return val * 4;<br>});<br>console.log(timesFour); // returns [4, 8, 12]<br>console.log(oldArray);  // returns [1, 2, 3]</blockquote>",

What these changes should look like

image

To contributors, please first read the contributing guidelines before taking care of this issue. And feel free to visit the Contributors Help chat room if you have any questions about helping. We're there to help.

@erictleung That's super clear! Thank you.

I'll take this one as my first potential commit if that's okay.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tzahile picture Tzahile  ·  3Comments

trashtalka3000 picture trashtalka3000  ·  3Comments

MelissaManning picture MelissaManning  ·  3Comments

raisedadead picture raisedadead  ·  3Comments

DaphnisM picture DaphnisM  ·  3Comments