Complete the code to check if a number is positive.
if (num [1] 0) { console.log('Positive number'); }
The condition num > 0 checks if the number is positive.
Complete the code to check if a number is positive and even.
if (num > 0) { if (num [1] 2 === 0) { console.log('Positive even number'); } }
/ instead of modulus %.The modulus operator % checks the remainder. If num % 2 === 0, the number is even.
Fix the error in the nested condition to check if a number is negative and odd.
if (num [1] 0) { if (num % 2 !== 0) { console.log('Negative odd number'); } }
The condition num < 0 checks if the number is negative.
Fill both blanks to check if a number is zero or positive and even.
if (num [1] 0) { if (num [2] 2 === 0) { console.log('Zero or positive even number'); } }
The first condition num >= 0 checks for zero or positive numbers. The second condition uses % to check if the number is even.
Fill all three blanks to check if a number is positive, even, and less than 100.
if (num [1] 0) { if (num [2] 2 === 0 && num [3] 100) { console.log('Positive even number less than 100'); } }
The first condition checks if num > 0 (positive). The second uses % to check evenness. The third checks if num < 100.