Primitive values
Tell simple values apart from arrays and objects.
Short practice challenges you can solve in any order. Every one gives feedback and an explanation.
Showing 24 of 24 challenges
Tell simple values apart from arrays and objects.
Find out what typeof reports for a whole number.
Predict what typeof reports for three different values.
Complete two string methods so the text is trimmed and upper-case.
Work out the length of a string.
Return a string in capital letters with an exclamation mark.
Print two lines with console.log.
Predict a comparison that surprises many beginners.
Predict what happens when you assign to a const.
Use a variable inside a printed message.
Follow a variable as it changes line by line.
Work out which part of an expression runs first.
See how + and - treat a string and a number.
Use the % operator to find a remainder.
Compare == and === on the same values.
Which values does if treat as false?
Put four lines in the order that makes the program work.
Follow an if / else if / else chain.
Choose a price with if and else, and get the boundaries right.
Write a function that returns a sum.
Turn a formula into a function.
A calculation that runs but gives the wrong answer.
A program that never starts: find the missing piece.
A condition that can never be true.