Recap - Sigma Function
Part of the Fundamentals section of Coddy's JavaScript journey — lesson 48 of 77.
Challenge
EasyWrite a function named sigma with one argument that represents the number n.
The function will return the sum of all the numbers from 1 to n (including).
For example, for sigma(5), the function will return 15, because 15 = 1 + 2 + 3 + 4 + 5.
Important! You don't need to call the function we do that for you behind the scenes in a function-type challenges.
Try it yourself
function sigma(n) {
// Write code here
}All lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Type Coercion7Bill Split Calculator
Welcome MessageCalculating The Tip And Total2Variables
NumbersStringBooleanNaming ConventionsEmpty VariablesRecap - Initialize VariablesConstants3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsComparison OperatorsStrict vs Loose EqualityRecap - Simple Math6Basic IO
OutputOutput with VariablesType Conversion - Part 1Type Conversion - Part 2Recap - Till 120Recap - True or False9Functions
Declare a FunctionArgumentsReturnRecap - Sigma FunctionFunction ExpressionDefault ParametersArrow FunctionsRecap - Validation Function