⊗jsPmCdNIF 128 of 502 menu

Nested if-else constructs in JavaScript

The if-else constructs can be nested arbitrarily. See an example:

let num = 3; if (num >= 0) { if (num <= 5) { console.log('less than or equal to 5'); } else { console.log('greater than 5'); } } else { console.log('less than zero'); }

Let the variable num store a number. If this number falls within the range from 10 to 99, then find the sum of the digits of this number. If the resulting sum is less than or equal to 9, then print a message that the sum of the digits is single-digit, otherwise, print a message that the sum of the digits is two-digit.

enru