Question · Vibe coding with Claude Code course · Module 4: Instagram clone

Quiz: Text for an Empty List

How do you show the text "Nobody has commented yet." only when the comments list is empty?

Answer options

  • <p if={photo.comments.length === 0}>Nobody has commented yet.</p>
  • {photo.comments.length === 0 && <p>Nobody has commented yet.</p>}
  • {photo.comments.length && <p>Nobody has commented yet.</p>}
  • <p hidden={photo.comments}>Nobody has commented yet.</p>

You can check the correct answer by solving this task in the CodeWorlds game.