Files
freeCodeCamp/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md
2022-01-20 20:30:18 +01:00

2.5 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
587d7b83367417b2b2512b37 freeCodeCamp とブラウザーのコンソールの違いを理解する 1 301193 understanding-the-differences-between-the-freecodecamp-and-browser-console

--description--

お気づきかもしれませんが、freeCodeCamp の一部のチャレンジには独自のコンソールが含まれています。 このコンソールは、ブラウザーのコンソールとは少し異なる動作をします。

console ではメッセージを出力するために多くのメソッドを使用します。 たとえば、log,、warnclear などがあります。 freeCodeCamp のコンソールは log メッセージのみを出力し、ブラウザーのコンソールはすべてのメッセージを出力します。 コードを変更すると、自動的に実行され、ログが表示されます。 freeCodeCamp のコンソールはコードが実行されるたびにクリアされます。

--instructions--

まず、ブラウザーのコンソールを開いてログを表示してください。 それには、一番上にある freeCodeCamp のナビゲーションバーを右クリックし、たいていのブラウザーでは inspect をクリックします。 次に、開いたウィンドウで console タブを探します。

その次に、console.log を使用して output 変数を出力してください。 ログを表示するため、2 つのコンソールを表示してください。 最後に、ログの後に console.clear を使用してブラウザーのコンソールをクリアしてください。 2 つのコンソールの違いを確認してください。

--hints--

console.log を使用して output 変数を出力します。

assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/));

console.clear() を使用してブラウザーのコンソールをクリアします。

assert(
  __helpers
    .removeWhiteSpace(code)
    .match(/console.clear\(\)/)
);

ログを表示した後、コンソールをクリアします。

assert(
  __helpers
    .removeWhiteSpace(code)
    .match(/console\.log\(output\)[\s\S]*console.clear\(\)/)
);

--seed--

--seed-contents--

let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";

--solutions--

let output = "Get this to show once in the freeCodeCamp console and not at all in the browser console";

console.log(output);
console.clear();