Answers for "function that calls itself"

2

what is it called when a function calls itself

Recursion
Posted by: Guest on August-24-2020
1

javascript recursion over array

function recurse(arr=[])
{
  	// base case, to break the recursion when the array is empty
    if (arr.length === 0) {
    	return;
    }
  	
  	// destructure the array
	const [x, ...y] = arr;
  
  	// Do something to x
  	
  	return recurse(y);
}
Posted by: Guest on February-08-2020

Code answers related to "function that calls itself"

Browse Popular Code Answers by Language