If you can create a random number between zero and one, start with that. If you multiply that number by 100, you'll end up with a random number between z and 100:

Code: Select all

```
let randNumZeroToOne = Math.random();
let randNumZeroToHundred = randNumZeroToOne * 100;
console.log(randNumZeroToHundred);
```

Notice that this number has lots of digits after the decimal point. You use Math.floor() to strip away all those digits (rounding your number down to the floor):

Code: Select all

`let newRandNum = Math.floor(randNumZeroToHundred);`

Then, you need to RETURN this number inside the function:

Put all that code inside of the function (between the { and the } ). Then whenever you need one of the numbers, just call that function

Code: Select all

`getRandomNumberBetweenOneAndHundred();`

If you're still having trouble, try doing a google search for "What is..." Math.random(), Math.floor(), console.log(), etc. You'll probably find many clear examples about how to use each one.

Hope this helps!

Oh and one more thing: after doing the google search, if you're still struggling with this concept, go ahead and try out the next chapter. Sometimes it takes seeing new examples to understand some of the foundational concepts. There's no shame in not getting it right away. If you can read code enough to understood the book well up until this chapter, then you've already got a big headstart over most 14 year olds (most don't know the first thing about coding). So don't be too hard on yourself. You'll be able to figure it out.

If you can create a random number between zero and one, start with that. If you multiply that number by 100, you'll end up with a random number between z and 100:

[code]

let randNumZeroToOne = Math.random();

let randNumZeroToHundred = randNumZeroToOne * 100;

console.log(randNumZeroToHundred);

[/code]

Notice that this number has lots of digits after the decimal point. You use Math.floor() to strip away all those digits (rounding your number down to the floor):

[code]

let newRandNum = Math.floor(randNumZeroToHundred);[/code]

Then, you need to RETURN this number inside the function:

[code]return newRandNum;[/code]

Put all that code inside of the function (between the { and the } ). Then whenever you need one of the numbers, just call that function

[code]

getRandomNumberBetweenOneAndHundred();[/code]

If you're still having trouble, try doing a google search for "What is..." Math.random(), Math.floor(), console.log(), etc. You'll probably find many clear examples about how to use each one.

Hope this helps!

Oh and one more thing: after doing the google search, if you're still struggling with this concept, go ahead and try out the next chapter. Sometimes it takes seeing new examples to understand some of the foundational concepts. There's no shame in not getting it right away. If you can read code enough to understood the book well up until this chapter, then you've already got a big headstart over most 14 year olds (most don't know the first thing about coding). So don't be too hard on yourself. You'll be able to figure it out.