Closed aksnell closed 4 years ago
https://github.com/aksnell/js-iteration
All tests passing, etc.
I can do the epic mode challenge, but I spent way to long trying to see if I could extend the actual array prototype (I understand why this is a terrible idea to never do for real) and I could not make Object.defineProperty and by then I had to move on to other work.
https://repl.it/@theoriginalaks/IntelligentGeneralDeletion#index.js
I have literally no idea whats wrong, it seems to my tired eyes, identical to every example I can find.
Use string interpolation here: return array.map((str, index) => str + " is at index " + index.toString())
It is something in the repl.it environment.
On my computer:
~ » node
Welcome to Node.js v14.4.0.
Type ".help" for more information.
> Array.prototype.myMap = () => console.log('hello')
[Function (anonymous)]
> [].myMap()
hello
On repl.it
Array.prototype.myMap = () => console.log('hello')
[Function]
[].myMap()
TypeError: [].myMap is not a function
at repl:1:4
at Script.runInContext (vm.js:131:20)
at REPLServer.defaultEval (repl.js:433:29)
at bound (domain.js:426:14)
at REPLServer.runBound [as eval] (domain.js:439:12)
at REPLServer.onLine (repl.js:759:10)
at REPLServer.emit (events.js:310:20)
at REPLServer.EventEmitter.emit (domain.js:482:12)
at REPLServer.Interface._onLine (readline.js:322:10)
Perhaps it is the way they are running the code, or a "security" feature.
Your homework 06 - 02 - Iteration in JavaScript was marked: Meets Expectations
“Well done!”
Objectives
After completing this assignment, you should be able to:
Instructions
hub clone js-iteration
cd js-iteration
yarn install
(or justyarn
for short)yarn test
src/functions.test.js
and work on functions until tests pass.Explorer Mode
Epic Mode
forEach
looping method and no other looping or enumeration helper, write your own version of the following methods, except name yours_map
,_filter
, etc.map
filter
reduce
every
some
Additional Resources
Reference the documentation on DevDocs to find what kind of helpful functions might already be in JavaScript.