loading...
Cover image for #7DaysJS: Primes Until n

#7DaysJS: Primes Until n

lautarolobo profile image Lautaro Lobo Originally published at lautarolobo.xyz on ・1 min read

Welcome to day 7 of 7 Days of JavaScript!

Today, on the last day of this challenge, we will tackle a hard one.

Write a function that takes a Natural number n, which returns all the primes from 0 to n and a string at the end with some phrase.

Example:

primesUntil(7)
...
2
3
5
'Why the string?'

Hint: you may want to use a helper function.

Give it time. If you feel frustrated, go take a walk and then sit down to try it again.

And then, read the solution here.

Posted on by:

lautarolobo profile

Lautaro Lobo

@lautarolobo

While you read this I'm learning something new. CS ♥️

Discussion

markdown guide