question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remainder challenge needs numbers directly used in modulo

See original GitHub issue

Challenge Finding a Remainder in JavaScript has an issue. User Agent is: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36. Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:


// Only change code below this line
var a=11;
var b=3;
var remainder;
var remainder=a % b;

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
erictleungcommented, May 11, 2016

@ashekgo thanks for the issue. Your answer will give the correct answer, but because our site is directed to beginner coders, this challenge is more simple than you think. The challenge simply wants you to take the remainder directly remainder = 11 % 3.

cc/ @FreeCodeCamp/issue-moderators worth changing? I was thinking we modify the You should use the % operator test to just look for the modulo character. Then we add another test that uses the current test looking for the modolo character to look for the use of two numbers directly with the modulo symbol.

/\d+\s*%\s*\d+/.test(code)
1reaction
yuens1002commented, Jun 4, 2016

Best to check if the variable remainder has been declared elsewhere or not have the variable remainder be declared by default. On Jun 3, 2016 5:09 PM, “Eric Leung” notifications@github.com wrote:

@yuens1002 https://github.com/yuens1002 mmm I see. We changed the test recently to look for var remainder = … However, as long as the remainder = …%… is there, it should be correct.

For anyone wanting to fix this, this line https://github.com/FreeCodeCamp/FreeCodeCamp/blob/staging/seed/challenges/01-front-end-development-certification/basic-javascript.json#L646 should be changed to:

“assert(/remainder\s_?=\s_?.%.;/.test(code), ‘message: You should use the % operator’);”

Please first read the contributing guidelines https://github.com/FreeCodeCamp/FreeCodeCamp/blob/staging/CONTRIBUTING.md before taking care of this issue. And feel free to visit the Contributors Help https://gitter.im/FreeCodeCamp/HelpContributors chat room if you have any questions about helping. We’re there to help.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FreeCodeCamp/FreeCodeCamp/issues/8570#issuecomment-223722200, or mute the thread https://github.com/notifications/unsubscribe/AGSn-wf8-iyhhQWkgvs3h97Ade95grX0ks5qIMIggaJpZM4IcCQW .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Program to find remainder without using modulo or % operator
Given two numbers 'num' and 'divisor', find remainder when 'num' is divided by 'divisor'. The use of modulo or % operator is not...
Read more >
What is modular arithmetic? (article) - Khan Academy
Visualize modulus with clocks. Observe what happens when we increment numbers by one and then divide them by 3. The remainders start at...
Read more >
Why is it if(number % 2 === 0) instead of just (number % 2)??
When we take away the modulo (subtract it from the dividend), the dividend resulting is factorable in terms of the modulus. It can...
Read more >
Excel MOD function to get remainder and more - Ablebits
The tutorial shows how to use the MOD function to get remainder in Excel, sum every Nth cell, highlight odd or even numbers,...
Read more >
Modular arithmetic/Introduction - Art of Problem Solving
5.1.1 Problem; 5.1.2 Solution; 5.1.3 Why we only need to use remainders ... then we can work directly with those remainders in modulo...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found