JavaScript JavaScript Basics Creating Reusable Code with Functions Giving Information to Functions

Upper

Why is he using "Upper"? What does that do?

1 Answer

Steven Parker
Steven Parker
176,576 Points

In this function, "upper" represents the parameter that is passed to the function to set the range of random numbers that will be produced. It's referred to as the "upper limit" which means that the random numbers picked by the function won't be any larger than that value.

Bozena Jablonski
Bozena Jablonski
4,881 Points

Sorry if this seems dim, but is upper a predefined or set parameter because he uses it without quote marks?

Steven Parker
Steven Parker
176,576 Points

Parameter names, like variable names, never have quote marks. Anything in quote marks is a string literal.