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.

Chunky Monkey: I'm returning the given solution but not solving the problem

See original GitHub issue

Chunky Monkey

https://www.freecodecamp.com/challenges/chunky-monkey

Issue Description

The code I’ve written correctly follows the steps as described in the problem and I’m returning the correct solution to each instance. However, none of the instances are being checked off as correct.

Browser Information

  • Browser Name, Version: Chrome
  • Operating System: Windows 7
  • Mobile, Desktop, or Tablet: Desktop

Your Code

var segments = [];
var newArray = [];
function chunkArrayInGroups(arr, size) {
  // Break it up.
  for (var i = 0; i < arr.length; i += size) {
    segments = arr.slice(i, i+size);
    newArray.push(segments);
    console.log(newArray);
  }
  return newArray;
}


chunkArrayInGroups(["a", "b", "c", "d"], 2);

Screenshot

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gonzalezi2commented, Jun 9, 2016

yeah that would make it more clear. I still have trouble with it at times because sometimes it is necessary to create it globally because if I create a local variable and try to call it outside I get the “out of scope” error. So yeah some clarification on that would go a long way. Thanks for your help!

0reactions
ghostcommented, Jun 10, 2016

Please use the Help chat room for getting challenge related help. Happy Coding!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chunky Monkey: I'm returning the given solution but not ...
The code I've written correctly follows the steps as described in the problem and I'm returning the correct solution to each instance. However, ......
Read more >
Chunky Monkey isn't working - JavaScript
Hi, I'm not sure what to do. I'm here expecting that the for loop increases by size and slices in this case with...
Read more >
Chunky Monkey - by Hugh Winchester
We need to write a function that splits an array (first argument) into groups the length of size (second argument) and returns them...
Read more >
free code camp -> Bonfire: Chunky Monkey
Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional...
Read more >
Holding 2 | Literature Quiz
Play this game to review Literature. What sentence states the main idea of a paragraph?
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