When numbers are entered into the two input fields #numA and #numB and the button #calcBtn is pressed, make it so that the sum of the two numbers is displayed in the paragraph #sum.
Hint: Since the values from the input fields are strings, simply using + directly will concatenate them, resulting in something like "34".
What you'll train
State the constraints
What you get
How to ask the AI
Clearly tell the AI that the values of #numA and #numB are retrieved as strings, so they need to be converted to numbers before being added together. It also helps to specify how to handle blank fields or non-numeric input.
If you ask vaguelyThe AI may forget the type conversion, resulting in "3" and "4" being displayed concatenated as "34" instead of being added.
あなたのコード
プレビュー
AIレビュー(プロンプト練習)
コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。