Which two code snippets show working examples of a recursive function? Choose 2 answers
Which two code snippets show working examples of a recursive function? Choose 2 answers
A . Let countingDown = function(startNumber) {
If ( startNumber >0) {
console.log(startNumber) ;
return countingDown(startNUmber);
} else {
return startNumber;
}};
B . Function factorial ( numVar ) {
If (numVar < 0) return;
If ( numVar === 0 ) return 1;
return numVar -1;
C . Const sumToTen = numVar => {
If (numVar < 0)
Return;
return sumToTen(numVar + 1)};
D . Const factorial =numVar => {
If (numVar < 0) return;
If ( numVar === 0 ) return 1;
return numVar * factorial ( numVar – 1 );
};
Answer: A,D
Latest JavaScript Developer I Dumps Valid Version with 144 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Subscribe
Login
0 Comments
Inline Feedbacks
View all comments