← All practice pages

JavaScript

JavaScript Conditionals

Conditionals branch your code with if/else, the ternary operator, or a lookup object when the branches are just a mapping.

Try it now

Optimize a function that uses multiple if-else chains to map status codes to messages. Replace with an object lookup pattern.

Create a free account to run your answer and get ARIA's review.