Read the question, write TypeScript on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Read two integers; log |a − b|.
Input. Two integers.
Output. Non-negative integer.
Examples
Input
10 3
Output
7
Input
3 10
Output
7
Hint
- Math.abs(a - b)
Show correct code
Peek only after you have tried. You can still Check your own version.
const [a, b] = readLine().trim().split(/\s+/).map(Number);
console.log(Math.abs(a - b));
main.tstsc · readLine() · Ctrl + Enter
ResultIdle
Run to see output. Check grades the tests.