Skip to content
Foxipa
Code Completion 6 Challenges

Complete the expressions

Practice operators, short-circuiting, nullish coalescing, conditional expressions, and grouping by completing real JavaScript code.

Beginner ~7 min read

Challenge 1

Complete the multiplication expression.

javascript Your answer
const total = 6  7;

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the strict comparison.

javascript Your answer
const same = 10  "10";

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the nullish fallback.

javascript Your answer
const name = undefined ?? ;

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the conditional expression that chooses the larger label.

javascript Your answer
const label = score >= 50  "Pass" : "Retry";

Press Ctrl⌘Enter to check your answer

Challenge 5

Add grouping so addition happens before multiplication.

javascript Your answer
const total =  * 4;

Press Ctrl⌘Enter to check your answer

Challenge 6

Complete the operator that assigns only when the value is nullish.

javascript Your answer
let value;
value  10;

Press Ctrl⌘Enter to check your answer