Truthy and Falsy
Truthy and Falsy
Conditionals do not only work with explicit booleans. Values like an empty string are falsy, so they can trigger a fallback path.
Your task: If profileName has a usable value, store it in displayName. If it is blank, store "Guest" instead. Log the display name.
Free with a JS Exercises account
Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.
By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.
Truthy and Falsy
Conditionals do not only work with explicit booleans. Values like an empty string are falsy, so they can trigger a fallback path.
Your task: If profileName has a usable value, store it in displayName. If it is blank, store "Guest" instead. Log the display name.