CodeDrill
day_streak: --
← 問題一覧に戻る
JavaScript ・ DOM Manipulation

Problem 2: Toggle text with a button

Each time the button #toggleBtn is pressed, make the text of the heading #status alternate between "Off" and "On".

What you'll train

State the constraints

What you get

  • Specify the initial state
  • Show the condition for alternating
  • Convey how to keep track of state

How to ask the AI

Clearly tell the AI whether the initial display should be "Off" or "On", and the condition for the alternating process, i.e., which text to switch to on each click.

If you ask vaguelyIf you don't specify the initial state, the AI might display "On" from the start, resulting in behavior opposite to what you intended on the first click.

あなたのコード

実行しました

プレビュー

AIレビュー(プロンプト練習)

コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。

先にコードを実行し、テストを1つ以上通してください。