π₯ Challenge for JavaScript Ninjas:
Can you solve this?
β€ Write a function that returnstrueif a number is almost prime β i.e., has exactly two distinct prime factors.β Try it out now β https://javascriptninjas.com/?page=6&order_by=&sort=&q=hard
πΉ 2. Interactive Style (for dev.to, Hashnode, blogs)
π‘ Can You Crack This?
Hereβs a brain-tickler for JavaScript learners:"Write a function that returns
trueif a number is almost prime β meaning it has exactly two distinct prime factors."For example:
yamlCopyEditInput: 6 β Output: true // (2 Γ 3) Input: 30 β Output: false // (2 Γ 3 Γ 5) β 3 distinct Input: 21 β Output: true // (3 Γ 7)Solve it directly here: π https://javascriptninjas.com/?page=6&order_by=&sort=&q=hard
πΉ 3. Competition Announcement Style (for Facebook/LinkedIn posts)
π Think youβre a JavaScript Ninja? Prove it.
This monthβs challenge:
π§© Write a function that returnstrueif a number is "almost prime" (has exactly 2 distinct prime factors).π Example:
6 β true,21 β true,30 β falseTry the full challenge here:
π https://javascriptninjas.com/?page=6&order_by=&sort=&q=hardπ° We run monthly competitions β winners get prizes & shoutouts!
πΉ 4. Gamified Format (for forums or gamified learning platforms)
πΉοΈ Mini-Boss Level: Almost Prime Check
Mission: Write a function to check if a number has exactly two distinct prime factors.Input β
6, Output βtrue
Input β30, Output βfalse
Input β21, Output βtrueπ― Take the challenge here: https://javascriptninjas.com/?page=6&order_by=&sort=&q=hard
πΉ 5. Plain Text for Email or WhatsApp Group
π Hey! Quick challenge for JavaScript lovers:
Can you write a function that returns
trueif a number is "almost prime" (i.e., has exactly two distinct prime factors)?Try these:
solve(6)βtrue
solve(30)βfalse
solve(21)βtrueSolve this now & join our monthly contest at:
π https://javascriptninjas.com/?page=6&order_by=&sort=&q=hard