Skip to content

Instantly share code, notes, and snippets.

@desinas
Last active December 20, 2017 08:35
Show Gist options
  • Save desinas/d4c4f349dc875b62c35e74abdc065550 to your computer and use it in GitHub Desktop.
Save desinas/d4c4f349dc875b62c35e74abdc065550 to your computer and use it in GitHub Desktop.
Factorial ( ! ) Quiz for Udacity FEWD
/*
* Programming Quiz: Factorials (4-7)
*/
var solution= 1;
for (var num= 4; num > 1; num--) {
//console.log(num + " x " + (num-1) + " = "); //verifying correct multilpication
solution = solution * num;
//console.log(solution + " + "); //verifying result
}
console.log(solution);
@desinas
Copy link
Author

desinas commented Dec 16, 2017

What Went Well

  • Your code should have a variable solution
  • Your code should use a for loop
  • Your for loop should correctly calculate the factorial

What Went Wrong: Verify that your for loop is producing the correct output ❌
Feedback: Not everything is correct yet, but you're close! ⚠️

@desinas
Copy link
Author

desinas commented Dec 20, 2017

What Went Well

  • Your code should have a variable solution
  • Your code should use a for loop
  • Your for loop should correctly calculate the factorial
  • Your code should produce the expected output

Feedback: Your answer passed all our tests! Awesome job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment