Back to Freecodecamp

Step 4

curriculum/challenges/english/blocks/workshop-mathbot/66ea8239b9eeb76f12299030.md

latest1.6 KB
Original Source

--description--

The next portion of the workshop is to review how to generate a random number between two values.

Start by adding another console.log() that logs the message "Now, generate a random number between two values." to the console.

Then, create a variable called min and assign it the value of 1 and create a variable called max and assign it the value of 100.

In the next step, you will generate a random number between these two values.

--hints--

You should have a console.log() that logs the message "Now, generate a random number between two values.".

js
assert.match(code, /console\.log\((`|'|")\s*Now,\s+generate\s+a\s+random\s+number\s+between\s+two\s+values\.\s*\1\);?/);

You should have a variable called min.

js
assert.isNotNull(min);

Your min variable should be a number.

js
assert.isNumber(min);

You should assign the number 1 to your min variable.

js
assert.equal(min, 1);

You should have a variable called max.

js
assert.isNotNull(max);

Your max variable should be a number.

js
assert.isNumber(max);

You should assign the number 100 to your max variable.

js
assert.equal(max, 100); 

--seed--

--seed-contents--

js
const botName = "MathBot";
const greeting = `Hi there! My name is ${botName} and I am here to teach you about the Math object!`;

console.log(greeting);

console.log("The Math.random() method returns a pseudo random number greater than or equal to 0 and less than 1.");

const randomNum = Math.random();
console.log(randomNum);
--fcc-editable-region--

--fcc-editable-region--