The numbers shower robot

Action functions available :

pickANumber (); pick a number between 5 and 120
show2Digits ('?'); where '?' = 'yes' or 'no'

Test functions available :

lessThan10 () which returns true or false
greaterOrEqual10 () which returns true or false
lessOrEqual99 () which returns true or false
greaterThan99 () which returns true or false

Warning !!!

Succeed your code with maximum 2 if, no else allowed.

Window to edit your JavaScript code

Test your script

Résult of the execution of your code

Notice: the five executions of your program must be correct without changing your code between them.

The numbers shower robot

The goal of this exercise is to construct Boolean expressions using AND and OR.

You are not to use « else » and since there are just 2 possibilities (for the number to be a 2-digit number or not), it should be possible to achieve this with two successive « if » statements and AND (&&) or OR (||).

The robot can pick a random number between 5 and 120. It must then check whether or not it is a 2-digit number, and show the result.

Good work.

◊ ◊ ◊

© Rupert Meurice de Dormale 2017

All rights reserved, reproduction in whole or in part of the interface and / or the code forbidden without the written agreement of the author

The drawings of the robots are of Jean-Baptiste Sonnet.

adresse