Skip to content
Permalink
7cf6fafdf8
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
20 lines (19 sloc) 452 Bytes
function range(start, end, step) {
let arr = []
if (step > 0){
for (let index = start; index <= end; index += step) {
arr.push(index)
}
} else if (step < 0)
for (let index = start; index >= end; index += step) {
arr.push(index)
} else return "Err"
return arr
}
function sum(array) {
let sum = 0;
array.forEach(item => {
sum += item
});
return sum
}