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.

Factorial Challenge: Correct, but doesn't register?

See original GitHub issue

Challenge Factorialize a Number has an issue. User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36. Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

var total = 1;
function factorialize(num) {
  for (var i=0; i<num; i++){
    total = total * (num - i);
  }
  return total;
}

factorialize(5);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jmacwanzccommented, Jun 29, 2016

@LonePoop You just need to declare the ‘total’ variable inside the function scope.

function factorialize(num) { var total = 1; for (var i=0; i<num; i++){ total = total * (num - i); } return total; } factorialize(5);

1reaction
arkucommented, Jun 29, 2016

Duplicate of #9199

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why won't factorial(100) work? - Codecademy
Out of curiosity (I wanna know whether the program will be fast enough to calculate something big), I just accidentally put 100 for...
Read more >
Extra long factorial challenge giving me different result in ...
I've tried putting "BigInt" before my result but that gives me something like "15511210043330985984000000n" this "n" at the end of every number.
Read more >
The factorial function (article) | Khan Academy
The factorial function is defined for all positive integers, along with 0. What value should 0! have? It's the product of all integers...
Read more >
Simple Factorial Challenge - Code Golf Stack Exchange
Given an integer n where 0 <= n <= 420, find the sum of the digits of n!. It's that simple :P. Notes:...
Read more >
Incredible Factorial Problem! - YouTube
This was the hardest problem in the 2002-3 British Mathematical Olympiad. Thanks to Nahian for the suggestion!British Mathematical Olympiad ...
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