デバッグしようとすると、この行で「長さ」の null エラーが発生します。本の指示どおりに書かれているので、なぜエラーが発生するのかわかりませんか? ありがとう、=)
if (capital.length < 1) {
(ここに要求された完全なコードがあります..申し訳ありません)
<script type="text/javascript">
var capital = window.prompt("What is the capital of Missouri?","")
if (capital.length < 1) {
document.getElementById("firstdiv").innerHTML="Sorry you don't feel like playing.<br /> The Capital of Missouri is Jefferson City.";
}
else {
if (!window.confirm("Is that your final answer?")){ return true;
document.getElementById("firstdiv").innerHTML = "The capital of Missouri is: <bold>" + capital + "</bold>, so says you.";
}
else{
return false;
}
}
</script>