Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Even or Odd | Section
JavaScript Fundamentals
セクション 1.  33
single

single

bookChallenge: Even or Odd

メニューを表示するにはスワイプしてください

タスク

スワイプしてコーディングを開始

Write code that determines whether a number is even or odd.
A number is even if it is fully divisible by 2. We can check this using the remainder operator (%).

For example:

  • 13 % 2 gives 1 → not fully divisible → odd.
  • 14 % 2 gives 0 → fully divisible → even.

We can use this property to distinguish between even and odd numbers.

Write the code inside the checkEvenOdd(num) function:

  • If the number is even → make the message variable equal to "The number is even".
  • If the number is odd → make the message variable equal to "The number is odd".

Use two different if statements to do this.

The result will be displayed automatically below the function.

解答

Switch to desktop実践的な練習のためにデスクトップに切り替える下記のオプションのいずれかを利用して、現在の場所から続行する
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 1.  33
single

single

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

some-alt