Cannot find bug

Hey coder friends. I cannot debug the code here. Please help!

  **Your code so far**
function rangeOfNumbers(startNum, endNum) {
if (endNum < startNum) {
  return [];
} else {
  var numbers = rangeOfNumbers(startNum, endNum - 1);
  return numbers;
console.Log(rangeOfNumbers(5, 1));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.33

Challenge: Use Recursion to Create a Range of Numbers

Link to the challenge:

You have an extra curly brace at the bottom, it works perfectly fine if it’s not there haha

TypeError: console.Log is not a function

This error in the output is telling you exactly what the issue is.

endnum=1 startnum=5 so first if condition is activated and return empty array after you solve typo error of console.Log i like recursion techniques


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.