"How do I write a JavaScript function that splits an array into groups and returns them as a two-dimensional array?"

I was struggling with this FreeCodeCamp lesson/exercise and I ended up finding the solution here on StackOverFlow: function chunkArrayInGroups(arr, size) { var result = []; while (arr.length > size) { result.push(arr.splice(0, size)); } if (arr.length) result.push(arr); return result; } chunkArrayInGroups(["a", "b"…