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.

Error: array.reduce(...) is not a function

See original GitHub issue

Challenge http://www.freecodecamp.com/challenges/waypoint-condense-arrays-with-reduce has an issue.

Error: array.reduce(…) is not a function

My code:

var array = [4,5,6,7,8];
var singleVal = 0;
// Only change code below this line.

singleVal = array.reduce(function(prev, cur) {
  return prev + cur;
})

// Only change code above this line.
(function() {return(singleVal);})();

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
benschenkercommented, Sep 8, 2015

@BerkeleyTrue, Agreed about the semicolons but is it possible to have a better error displayed? Right now it just says YYY is not a function and that isn’t really helpful in this situation.

2reactions
zloy531commented, Aug 21, 2015

But I still think what this is a bug. Semicolons isn’t necessary in EcmaScript. Result should not depend on semicolons. Or, at least, error must be more verbose.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: this.reduce is not a function [duplicate]
This is happening because you are using for..in on an array. You shouldn't be doing that. When you added Array.prototype.xintsum , you added ......
Read more >
Error: array.reduce(...) is not a function · Issue #2427 - GitHub
Error : array.reduce(...) is not a function My code: var array = [4,5,6,7,8]; var singleVal = 0; // Only change code below this...
Read more >
TypeError: Reduce of empty array with no initial value
The JavaScript exception "reduce of empty array with no initial value" occurs when a reduce function is used.
Read more >
Array.reduce not a function? - Google Groups
in a reduce function as part of a M / R call? I know that V8 (and. Node.js) accept a reduce call, but...
Read more >
TypeError: e.reduce is not a function error - Prismic People
Hi Mitchel,. This error occurs when you pass anything other than a Rich Text field to the asHtml helper function. Looking at your...
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