Pagina de inicio
/
Tecnología
/
Fill in the blank: function main() console.log("Do I need a raincoat?"): //create a variable that stores whether or not it is raining and use the Randomizer to assign a random Boolean value __ console.log(isRaining); if (isRaining) ( console.log("It's raining. Yes you need your raincoat."); else ( console.log("No, you do not need a raincoat "): main(): let isRaining=Bool.randomO isRaining=Randomizer.nextBoolean() Randomizer.nextBoolean() let isRaining=Randomizer.nextBoolean()

Problemas

Fill in the blank:
function main()
console.log("Do I need a raincoat?"):
//create a variable that stores whether or not it is raining and use
the Randomizer to assign a random Boolean value
__
console.log(isRaining);
if (isRaining) (
console.log("It's raining. Yes you need your raincoat.");
else (
console.log("No, you do not need a raincoat "):
main():
let isRaining=Bool.randomO
isRaining=Randomizer.nextBoolean()
Randomizer.nextBoolean()
let isRaining=Randomizer.nextBoolean()

Fill in the blank: function main() console.log("Do I need a raincoat?"): //create a variable that stores whether or not it is raining and use the Randomizer to assign a random Boolean value __ console.log(isRaining); if (isRaining) ( console.log("It's raining. Yes you need your raincoat."); else ( console.log("No, you do not need a raincoat "): main(): let isRaining=Bool.randomO isRaining=Randomizer.nextBoolean() Randomizer.nextBoolean() let isRaining=Randomizer.nextBoolean()

Solución

avatar
Angelamaestro · Tutor durante 5 años
expert verifiedVerificación de expertos
4.0 (227 votos)

Responder

The correct answer is:<br />```javascript<br />let isRaining = Randomizer.nextBoolean();<br />console.log(isRaining);<br />if (isRaining) {<br /> console.log("It's raining. Yes you need your raincoat.");<br />} else {<br /> console.log("No, you do not need a raincoat.");<br />}<br />```<br />Explanation:<br />The question is asking to fill in the blank in the given JavaScript code to create a variable that stores whether or not it is raining and use the Randomizer to assign a random Boolean value. The correct answer is to use the `let` keyword to create a variable named `isRaining` and assign it the value of `Randomizer.nextBoolean()`. This function returns a random Boolean value, either `true` or `false`. The variable `isRaining` is then used in the `if` statement to determine whether or not it is raining and whether or not the user needs a raincoat.
Haz clic para calificar: