Reading and validating console input

What number does parseInt produce after trim?

Examples

Worked example

Input
Input line: ' 42 '
Expected output
42

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

Trimming strips the surrounding spaces. Parsing then converts the two remaining digits to an integer.

Back to the lesson