Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No tests do not tick, even though all requirements are met #11832

Closed
itsbillyy opened this issue Nov 27, 2016 · 3 comments
Closed

No tests do not tick, even though all requirements are met #11832

itsbillyy opened this issue Nov 27, 2016 · 3 comments

Comments

@itsbillyy
Copy link

Challenge Factorialize a Number has an issue.
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.
After manually testing all the requirements, the tests do not tick.

My code:

var numberValue = 1;
function factorialize(num) {
  for (i=1; i<= num; i++) {
    numberValue *= i;
  }
  return Number(numberValue);
}
factorialize(0);
@erictleung
Copy link
Member

@itsbillyy our tests run your function factorialize() sequentially, one after each other. So global variables are changed with each run. Move your numberValue global variable within your function and you should pass the challenge. Happy coding!

@JohnnyBizzel
Copy link

I'm not sure you should close this issue. It is clearly valid to have global variables.

@erictleung
Copy link
Member

@JohnnyBizzel yes, global variables are perfectly valid to use in code. Nonetheless, this is a duplicate of #9199 and this would've been closed in favor of that one. Feel free to continue the discussion over in the other issue. Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants