question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Object Oriented and Functional Programming DESPERATELY needs rewrite!

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
heldersepucommented, Jun 27, 2016

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

2reactions
erictleungcommented, Jul 4, 2016

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Code Evolve from Procedural to Object-Oriented to ...
Join me in this coding journey, and may it demonstrate their differences and the need for paradigms shift with greater clarity. Structural ...
Read more >
Switching from OOP to Functional Programming - Medium
Switching to FP style indeed requires a mindset change. You no longer have your usual primitives, like classes, mutable variables, loops, ...
Read more >
When Object Orientation Met Functional Programming
When the worlds of object orientation and functional programming collide, there can be awkward moments. Imagine, if you will, object orientation ...
Read more >
Does OOP fulfill the promise of code reuse? What alternatives ...
And of course it's hard to reuse. But the same code, containing the same knowledge, would be even harder to reuse without OOP....
Read more >
Rekindling an Old Flame with C++11 - Atomic Spin
... Linux–rewriting some code that was written in C. Programming in C was not pleasant, and I desperately needed object-oriented constructs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found