bugger.
All challenges/JavaScripteasyquick-js-default-v1
THE INVESTIGATION

Keep a zero setting

Given an object with an optional numeric limit, return its limit or 10 when it is missing or null. Zero is a valid limit.

JavaScript

What’s going wrong

Original short debugging exercise. Given an object with an optional numeric limit, return its limit or 10 when it is missing or null. Zero is a valid limit. Read one JSON value from standard input and print the result as JSON. Inputs follow the stated contract. Repair the function and run the checks.

Expected behavior

Given an object with an optional numeric limit, return its limit or 10 when it is missing or null. Zero is a valid limit.

Reproduction

01 Reproduction
{"limit": 0}
0
02 Control
{"limit": 5}
5

Before you begin

  • Basic JavaScript expressions

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    The bug is intentional. Run the starter code to see it fail, then work toward a fix. Difficulty is provisional.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.