Practice
JavaScriptData StructuresReactConcepts
Sign in
← Back to problems

Functions Calling Functions

Fundamentals: Part 2easy

Course · Section 3: JavaScript Fundamentals – Part 2 · Lecture 37: Functions Calling Other Functions

Implement `doubleThenInc(n)` using two helper functions: one that doubles and one that adds one. Double first, then increment.

Sample tests

Input: doubleThenInc(3)
Output: 7
Input: doubleThenInc(0)
Output: 1

+ 1 hidden test run on Submit.

Hints

Common pitfalls
  • Applying the operations in the wrong order.
Visualize this concept: let, const, var, and the Temporal Dead Zone →
Approach & explanation (try first)

One function calls another, composing double then increment.

Loading...
⌘/Ctrl + Enter

Run your code to see results.