{if(.>1){returnmyFunc(.slice(1));}return;};.log(myFunc('Hello world'));Select one:← Object Keys, Object ValuesFunction Equality → Mailing List!StarStarStarJavaScript knowledge quizzes by Nick Scialli. Follow me on TwitterTwitter! I also make free YouTube tutorial videosYouTube tutorial videos!Read why I make these quizzes »ContributorsThanks to these awesome contributorsthese awesome contributors for helping out with tasks ran..." />{if(.>1){returnmyFunc(.slice(1));}return;};.log(myFunc('Hello world'));Select one:← Object Keys, Object ValuesFunction Equality → Mailing List!StarStarStarJavaScript knowledge quizzes by Nick Scialli. Follow me on TwitterTwitter! I also make free YouTube tutorial videosYouTube tutorial videos!Read why I make these quizzes »ContributorsThanks to these awesome contributorsthese awesome contributors for helping out with tasks ran..." />Basic Recursion | TypeOfNaN JavaScript Quizzes
Home | Mailing List | Blog | Tutorial Videos

Basic Recursion

Consider the following recursive function. If we pass the string "Hello World" to it, what gets logged?

const myFunc = str => {
  if (str.length > 1) {
    return myFunc(str.slice(1));
  }

  return str;
};

console.log(myFunc('Hello world'));

Select one: