ユーザーがパターンを正しく取得するにつれてパターンが徐々に長くなる Simon Says ゲームを作成していますが、入力履歴には以前のパターン入力が表示されます。この履歴をクリアするにはどうすればよいですか?
このコードは CodeHS サイトにあります。console.clear();、clear(); を調査して試しました。および console.API.clear(); ですが、うまくいかないようです。
これは、ユーザーの入力を取得するコードのセクションです。
//green red blue yellow
var generatedPattern = "grby"
function getUserInput(){
/*User input of the last round gets saved which shows them 'grb', allowing
the user to look back at their previous guess to easily guess the
next pattern*/
guess = readLine("Input guess here: (example: ybbg)");
if(guess == generatedPattern){
return true;
}else{
return false;
}
}
clear(); でログがクリアされることを期待しています。または console.clear(); ですが、何もしません。