JQuery Ready Calls No Arguments Returning Die Roll Function

This is an example of calling a Javascript function that has no arguments and returns a value. The function is called from the JQuery ready method. You need a web browser console window open to observe. Refresh page as needed.

You can use the returned results elsewhere in your Javascript code.

Functions should alway return the same data type to avoid bugs. So if a number is expected as a returned data type, then do not return a string.

Often the function name will indicate it returns data and the type of data returned. For example getFirstName() indicates a return value of string.

Refresh Browser for More Rolls