ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 78 - Certified JavaScript Developer I discussion

Report
Export

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;}};
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;
Answers
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)};
Answers
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 );};
Answers
D.
Const factorial =numVar => {If (numVar < 0) return;If ( numVar === 0 ) return 1;return numVar * factorial ( numVar - 1 );};
Suggested answer: A, D
asked 23/09/2024
JUAN LUIS BERMUDEZ MAYORAL
27 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first