Question: # Task Provide 3 unique implementations of the following function. **Input**: `n` - any integer *Assuming this input will always produce a result lesser than

# Task

Provide 3 unique implementations of the following function.

**Input**: `n` - any integer

*Assuming this input will always produce a result lesser than `Number.MAX_SAFE_INTEGER`*.

**Output**: `return` - summation to `n`, i.e. `sum_to_n(5) === 1 + 2 + 3 + 4 + 5 === 15`.

Implementations:

1:

var sum_to_n_a = function(n) { // your code here };

2:

var sum_to_n_b = function(n) { // your code here };

3:

var sum_to_n_c = function(n) { // your code here };

IN JAVASCRIPT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!