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

factorial.js: Standardjs fixes #145

Merged
merged 3 commits into from May 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions maths/factorial.js
Expand Up @@ -13,7 +13,7 @@

'use strict'

function calc_range (num) {
function calcRange (num) {
// Generate a range of numbers from 1 to `num`.
var i = 1
var range = []
Expand All @@ -24,9 +24,9 @@ function calc_range (num) {
return range
}

function calc_factorial (num) {
function calcFactorial (num) {
var factorial
var range = calc_range(num)
var range = calcRange(num)

// Check if the number is negative, positive, null, undefined, or zero
if (num < 0) {
Expand All @@ -48,5 +48,6 @@ function calc_factorial (num) {
}

// Run `factorial` Function to find average of a list of numbers.
/* global alert, prompt */
var num = prompt('Enter a number: ')
alert(calc_factorial(num))
itsvinayak marked this conversation as resolved.
Show resolved Hide resolved
console.log(calcFactorial(num))