function howManyTimes(num, str) {
if (!str) str = '';
if (num > 0) {
return howManyTimes(num - 1, str + 'a');
} else {
return `Ed${str}bit`;
}
}
console.log(howManyTimes(8));
One issue is that your recursion is always appending the result of the method to an a. Rather than doing that, pass along the aggregated string to then be used once you reach the end.
GitHub
github.com › timothyshores › Edabit
GitHub - timothyshores/Edabit: My solutions to JavaScript practice challenges on Edabit.com. My profile 👉
My solutions to JavaScript practice challenges on edabit.com
Author timothyshores
Edabit
dev.edabit.com › challenges › javascript
2500+ JavaScript Practice Exercises // Edabit
We cannot provide a description for this page right now
03:37
DevTips Daily: Edabit JavaScript coding challenge - Calculate Power ...
21:51
Hard JavaScript Challenges with Edabit - YouTube
23:13
Medium JavaScript Challenges with Edabit - YouTube
02:31
DevTips Daily: Edabit JavaScript coding challenge - Remainder of ...
27:59
VERY EASY JAVASCRIPT CHALLENGES ON EDABIT.COM | FOR BEGINNERS | ...
DEV Community
dev.to › toddster79 › edabit-com-my-favorite-resource-for-javascript-practice-problems-443g
Edabit.com My Favorite Resource for JavaScript Practice Problems - DEV Community
August 16, 2020 - I personally use edabit.com for JavaScript, but there are several other languages to choose from. Which is awesome because I plan to learn C# and PHP in the future. Edabit.com's two most powerful features for learning, in my humble opinion, are the resources tab, and the ability to see other user's solutions once you've submitted your solution.
YouTube
youtube.com › watch
Easy JavaScript Exercises with Edabit - YouTube
In this JavaScript tutorial I’ll introduce you to the Edabit coding platform and we’ll complete some east Edabit JavaScript exercises.Get started with Edabit...
Published January 12, 2021
GitHub
github.com › topics › edabit
edabit · GitHub Topics · GitHub
This repo contains my solutions to the challenges i took in Edabit, I will try to keep it always updated as i go further. javascript solutions challenges easy challenges-solved edabit
Top answer 1 of 3
1
function howManyTimes(num, str) {
if (!str) str = '';
if (num > 0) {
return howManyTimes(num - 1, str + 'a');
} else {
return `Ed${str}bit`;
}
}
console.log(howManyTimes(8));
One issue is that your recursion is always appending the result of the method to an a. Rather than doing that, pass along the aggregated string to then be used once you reach the end.
2 of 3
1
You can always separate out the part that can use straightforward recursion from a shell that calls that part and does something with the result. For instance,
const nAs = (n) =>
n == 0 ? '' : nAs (n - 1) + 'a'
const howManyTimes = (n) =>
`Ed${nAs (n)}bit`
console .log (howManyTimes (0))
console .log (howManyTimes (1))
console .log (howManyTimes (10))
Of course I would only write it this way in a recursion challenge. For this example, there are more straightforward ways to write this, including const howManyTimes = (n) => `Ed${'a'.repeat(n)}bit`
Edabit
dev.edabit.com
Edabit // Learn Programming with 10,000+ Interactive Exercises
We cannot provide a description for this page right now
Edabit
edabit.com › challenges
10000+ Coding Practice Challenges // Edabit
Create a function that takes a number as an argument, increments the number by +1 and returns the result. Examples addition(0) ➞ 1 addition(9) ➞ 10 addition(-3) ➞ -2 Notes Don't forget to return the result.
Edabit
edabit.com › tutorial › javascript
The #1 JavaScript Tutorial for Beginners // Edabit
This tutorial is designed for beginners. It will take you from knowing nothing about JavaScript to solving bite-sized JavaScript exercises when you're done.
GitHub
github.com › mindiae › edabit-javascript
GitHub - mindiae/edabit-javascript: My solutions to edabit.com javascript challenges · GitHub
My solutions to edabit.com javascript challenges. Contribute to mindiae/edabit-javascript development by creating an account on GitHub.
Author mindiae
GitHub
github.com › bikkimahato › Edabit-Challenges-JavaScript
GitHub - bikkimahato/Edabit-Challenges-JavaScript: Solving and providing solutions for Edabit Challenges JavaScript for Very Easy, Easy, Medium, Hard, Very Hard, Expert coding questions. · GitHub
Solving and providing solutions for Edabit Challenges JavaScript for Very Easy, Easy, Medium, Hard, Very Hard, Expert coding questions. - bikkimahato/Edabit-Challenges-JavaScript
Author bikkimahato
GitHub
github.com › mister-josuecedeno › edabit
GitHub - mister-josuecedeno/edabit: Daily Javascript Coding Practice
Prime.js 2021-09-21 - split.js 2021-09-22 - probability.js 2021-09-23 - squarePatch.js 2021-09-24 - firstBeforeSecond.js 2021-09-25 - findVertex.js 2021-09-26 - findVertex.js (solved) 2021-09-28 - isCircleCollision.js 2021-09-29 - quadraticEquation.js 2021-09-30 - inatorInator.js 2021-10-01 - StringPrototype.js 2021-10-02 - gradNumberSum.js 2021-10-03 - simonSays.js 2021-10-04 - isEqual.js 2021-10-05 - count_towers.js 2021-10-07 - pingPong.js 2021-10-08 - accum.js 2021-10-09 - magnitude.js 2021-10-09 - capLast.js 2021-10-10 - divingMinigame.js 2021-10-11 - malthusian.js 2021-10-12 - validDivis
Starred by 11 users
Forked by 2 users
Languages JavaScript 99.9% | HTML 0.1% | JavaScript 99.9% | HTML 0.1%
GitHub
github.com › Muhammad-Tahir-S › Edabit-Challenges-Javascript
GitHub - Muhammad-Tahir-S/Edabit-Challenges-Javascript: Javascript Challenges from Edabit · GitHub
Javascript Challenges from Edabit. Contribute to Muhammad-Tahir-S/Edabit-Challenges-Javascript development by creating an account on GitHub.
Starred by 11 users
Forked by 13 users
Languages JavaScript
GitHub
github.com › nikclayton › edabit-javascript-challenges
GitHub - nikclayton/edabit-javascript-challenges: Javascript challenges forked from Edabit · GitHub
Javascript challenges forked from Edabit. Contribute to nikclayton/edabit-javascript-challenges development by creating an account on GitHub.
Starred by 28 users
Forked by 23 users
Languages JavaScript