Hello everyone!
I´m learnin by myself some javascript and I´m performing some exercises.
They ask me to create this:
"Generate a random integer number between 0 and 99 and assign it to the luck variable.
Write a condition that should check if Mr. Pink's luck is greater than 90. If so, the conditional statement should assign 'Mr. Purple' to alias. Otherwise, it should assign 'Mr. Pink'.
Print the alias value to the console."
They give this as an example:
Also on the console they already provide me two variables, I need to complete the rest. I´m getting error messages regarding the creation of the integer number. In the past I did one time with this simple code, but now is not working, the console says "
>>>>Code is incorrect
Remember to generate a random number between 0 and 99. That number needs to be an integer."
I created this code so far but I now it is wrong:
Can anyone help me with this issue?
Thanks
Raquel
I´m learnin by myself some javascript and I´m performing some exercises.
They ask me to create this:
"Generate a random integer number between 0 and 99 and assign it to the luck variable.
Write a condition that should check if Mr. Pink's luck is greater than 90. If so, the conditional statement should assign 'Mr. Purple' to alias. Otherwise, it should assign 'Mr. Pink'.
Print the alias value to the console."
They give this as an example:
JavaScript:
var speed;
var whatNow = speed < 80 ? 'BOOOM!' : 'Keep driving';
console.log(whatNow); // if speed is lower than 80 bus explodes; if not, you better keep driving
Also on the console they already provide me two variables, I need to complete the rest. I´m getting error messages regarding the creation of the integer number. In the past I did one time with this simple code, but now is not working, the console says "
>>>>Code is incorrect
Remember to generate a random number between 0 and 99. That number needs to be an integer."
JavaScript:
var someRandoNumber = Math.random()*42;
console.log(Math.ceil(Math.random()*42)
I created this code so far but I now it is wrong:
JavaScript:
var luck = RandomNumber;
var alias = luck < RandomNumber? 'Mr Pink´s': 'Mr Purple';
var RandomNumber = Math.random()*99;
console.log(Math.ceil(Math.random()*99));
console.log(alias);
Can anyone help me with this issue?
Thanks
Raquel