Repair an empty-input crash

Difficulty: Easy

JavaScript

Repair the buggy starter to meet this contract: Return the first integer in values, or null/None if empty.

Test-design prompt

Add a case where the first value is zero and explain why a truthiness fallback fails.

Before editing, identify a minimal failing input and predict the result. After repairing, rerun the regression cases and explain why the old implementation failed.

Examples

[]null
[0, 2]0
[-1]-1

Constraints

Inputs are JSON-compatible. Unless a tighter bound is stated, lists have at most 200 elements, strings at most 1000 characters, and integers are within -1000000..1000000. Do not mutate inputs. Use only the browser runner; no file or network access. Preserve the required function signature.

Review lesson: Read errors before changing code
JavaScript

Ready when you are

Write your solution, then run it against the practice tests.

Press Esc, then Tab to leave the editor. Code runs in an isolated browser workspace. Tests support learning, not verified grading.

Reset your code?

This replaces your current code with the starter and stops any running tests.