Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Sum of a sequence

// Your task is to make function, which returns the sum of a sequence of integers.
// The sequence is defined by 3 non-negative values: begin, end, step (inclusive).
// If begin value is greater than the end, function should returns 0

const sequenceSum = (begin, end, step) => {
  let sum = 0;
  for(let i = begin; i <= end; i += step) sum += i;
  return sum;
};

// With love @kouqhar
Comment

PREVIOUS NEXT
Code Example
Javascript :: what is lodash omitBy 
Javascript :: is there an api for netflix shows 
Javascript :: React Redux store exemple 
Javascript :: how to display message in javascript 
Javascript :: bs modal service angular pass data 
Javascript :: react map example leaflets 
Javascript :: javascript array looping 
Javascript :: difference between dom and react dom 
Javascript :: add role command discord.js 
Javascript :: min in array 
Javascript :: how to hack facebook 
Javascript :: && operator in react 
Javascript :: javascript array methods cheat sheet 
Javascript :: javascript prompt on window close 
Javascript :: filter 2d array javascript 
Javascript :: javascript regex get domain from url 
Javascript :: luhn algorithm javascript 
Javascript :: LEAODE MAJE 
Javascript :: javascript console log current directory 
Javascript :: how to change a sting into js code 
Javascript :: javascript loop array 
Javascript :: react js props lara css uygulama 
Python :: python most used functions 
Python :: seaborn rotate x labels 
Python :: remove all pyc 
Python :: how to convert a column to datetime in pandas 
Python :: remove column from df 
Python :: python beep windows 
Python :: ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True site:stackoverflow.com 
Python :: how to automatically copy an output to clipboard in python 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =