All academies
All challenges

Parse Coordinates into a Tuple

mediumbasics100 XP

Problem

Write parsePoint(input: string): [number, number] that parses a string like "3,4" into a tuple of exactly two numbers. The return type must be a tuple, not number[], so consumers know it always has exactly two elements. Assume the input is always well-formed.

Expected output

[3,4]
[-2,7.5]

Hints

Stuck? Reveal hints one at a time.

Solution

Try solving it yourself first — revealing is always available.

Press Run in the editor — your console output is checked automatically.
No errors
Loading...

Console output appears here. Press Run or just type — the code compiles automatically.