Practice
JavaScriptData StructuresReactConcepts
Sign in
← Back to problems

Increment N Times

A Closer Look at Functionsmedium

Course · Section 10: A Closer Look at Functions · Lecture 135: Default Parameters

Implement `incrementTimes(start, times)` returning `start` after being incremented `times` times.

Sample tests

Input: incrementTimes(0, 3)
Output: 3
Input: incrementTimes(10, 0)
Output: 10

+ 1 hidden test run on Submit.

Hints

Common pitfalls
  • Looping one time too many or too few.

Learning resources

  • MDN: Functions
Approach & explanation (try first)

A simple loop adds one to a local copy of start, times times.

Loading...
⌘/Ctrl + Enter

Run your code to see results.