Skip to content
Foxipa
Code Completion 8 Challenges

Complete the values, types, and equality expressions

Practice explicit conversion, strict equality, NaN checks, nullish fallback, BigInt, SameValue, and numeric comparison by completing real JavaScript code.

Intermediate ~7 min read

Challenge 1

Convert the text to a Number.

javascript Your answer
const age = Number()

Press Ctrl⌘Enter to check your answer

Challenge 2

Convert the empty string to a Boolean.

javascript Your answer
const ready = Boolean()

Press Ctrl⌘Enter to check your answer

Challenge 3

Use strict equality to compare a Number with the same Number.

javascript Your answer
const same = 42  42;

Press Ctrl⌘Enter to check your answer

Challenge 4

Use the explicit NaN test.

javascript Your answer
const invalid = Number("oops");
const bad = Number.isNaN()

Press Ctrl⌘Enter to check your answer

Challenge 5

Choose the nullish fallback operator.

javascript Your answer
const label = value  "Guest";

Press Ctrl⌘Enter to check your answer

Challenge 6

Write a BigInt literal.

javascript Your answer
const total = 9007199254740993;

Press Ctrl⌘Enter to check your answer

Challenge 7

Use SameValue semantics for the equality check.

javascript Your answer
const differentZeroes = Object.is(+0, );

Press Ctrl⌘Enter to check your answer

Challenge 8

Force numeric comparison of two numeric strings.

javascript Your answer
const earlier = Number("10")  Number("20");

Press Ctrl⌘Enter to check your answer